“连接中止。”使用请求时

2024-09-30 05:17:45 发布

您现在位置:Python中文网/ 问答频道 /正文

import requests
url = 'http://femhzs.mofcom.gov.cn/fecpmvc/pages/fem/CorpJWList_nav.pageNoLink.html;jsessionid=8C736597A2750E8A4D32363D15A9A5DF?session=T&sp=1&sp=S+_t1.CORP_CDE%2C+_t1.id&sp=T&sp=S'
headers = { 'User-Agent': "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36"}
r = requests.get(url,headers = headers)

我的代码显示在上面,而这得到一个连接中止错误。我该怎么办,需要帮助。在


Tags: importhttpurlpagescnrequestsspheaders
1条回答
网友
1楼 · 发布于 2024-09-30 05:17:45

你的网址不起作用,但你使用的一切都是正确的

In [168]: url = 'https://www.google.com'

In [169]: response = requests.get(url, headers=headers)

In [170]: response.status_code
Out[170]: 200

相关问题 更多 >

    热门问题