打算在http://app1.sfda.gov.cn/上获取一些数据整理起来,想用python.requests实现一个小爬虫来获取数据,但是python.requests会一直报('Connection aborted.', ConnectionResetError(54, 'Connection reset by peer')的错误,但是那个网站是的的确确能上的,各位有知道我错在哪里吗,谢谢??代码如下:import requestsdef testLoadRequest(): officialHeader = { 'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) ' 'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36', 'referer':'http://app1.sfda.gov.cn/', 'Upgrade-Insecure-Requests':'1' } officialUrl = 'http://app1.sfda.gov.cn'; try: officialRequest = requests.get(officialUrl, headers= officialHeader) print(officialRequest.content) except Exception as e: print(e)testLoadRequest()
添加回答
举报
0/150
提交
取消