HTTPSConnectionPool(host='*-my.sharepoint.com', port=443): Max retries exceeded with url: /personal/*_onmicrosoft_com  uploadSession?guid='*(Caused by ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer')))

 

 

python requests请求报错

ConnectionError: (‘Connection aborted.’, error(104, ‘Connection reset by peer’))

可能导致的有两个原因
1. 请求过于频繁, 导致请求被拒绝

解决方法:

每次请求设置一个休眠时间例如
time.sleep(1)
2. 接口有认证或者反爬机制, 识别到是python终端访问, 拒绝了访问

解决方法:

在请求头中设置 User-Agent 绕过验证

headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko',"Content-Type": "application/json"}

 

原文blog.csdn.net/weixin_43925447/article/details/123191482

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。