使用请求

时间:2018-05-21 21:56:39

标签: python python-requests

link="https://report-abc.com/crp/cdo"


node_id_1="00163E0F0D0C1ED895"

params={'id':node_id_1,
        'list':'142',
        'queue': 'gen',
        'type': 'crp_stat'
       }

headers = {'accept': 'application/json'}


req_obj= requests.get(link, params=params,headers=headers)
print(req_obj.url)
print(req_obj.status_code)

然而,虽然它昨天工作,但我得到的数据虽然是html格式而不是json。今天它给我带来连接错误:

ConnectionError: HTTPSConnectionPool(host='report-abc.com', port=443): Max retries exceeded with url: /crp/cdo?queue=gen&list=142&id=00163E0F0D0C1ED895&type=crp_stat (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x107362a90>: Failed to establish a new connection: [Errno 61] Connection refused',))

我已经尝试过此堆栈溢出问题中提到的建议,包括安装pyopenssl:

Max retries exceeded with URL

但它似乎没有帮助。

任何想法都会非常感激。感谢

0 个答案:

没有答案