微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

'连接中止', ConnectionResetError(104, '连接重置'))

如何解决'连接中止', ConnectionResetError(104, '连接重置'))

我正在 Google Colab 中运行此脚本

<form method="post">
  <input type="hidden" name="contractorid" value="3">
  <input type="hidden" name="contractorfirstname" value="Tom">
  <input type="hidden" name="contractorlastname" value="Grant">
  <input type="hidden" name="contractoremail" value="tomgrant@grouting.com">
  <input type="hidden" name="contractorcompany" value="Grant" grouting>
  <input type="hidden" name="contractorphone" value="">
  <input name="editcontractor" type="submit" value="Edit this contractor">
</form>

但我总是收到这条消息

import pandas as pd
import requests
from bs4 import BeautifulSoup as b

url = "http://resultadoshistorico.onpe.gob.pe/EG2021/EleccionesPresidenciales/RePres/P/020000/021300"
html = requests.get(url)
content=html.content
soup=b(content,"lxml")

print(soup)

为了再试一次,我曾尝试从 Mozilla 迁移到 Brave,但结果是一样的。 我还在 Stackoverflow 中查看了其他讨论,但他们建议安装 --------------------------------------------------------------------------- ConnectionResetError Traceback (most recent call last) /usr/local/lib/python3.7/dist-packages/urllib3/connectionpool.py in urlopen(self,method,url,body,headers,retries,redirect,assert_same_host,timeout,pool_timeout,release_conn,chunked,body_pos,**response_kw) 599 body=body,headers=headers,--> 600 chunked=chunked) 601 24 frames ConnectionResetError: [Errno 104] Connection reset by peer During handling of the above exception,another exception occurred: ProtocolError Traceback (most recent call last) ProtocolError: ('Connection aborted.',ConnectionResetError(104,'Connection reset by peer')) During handling of the above exception,another exception occurred: ConnectionError Traceback (most recent call last) /usr/local/lib/python3.7/dist-packages/requests/adapters.py in send(self,request,stream,verify,cert,proxies) 496 497 except (ProtocolError,socket.error) as err: --> 498 raise ConnectionError(err,request=request) 499 500 except MaxRetryError as e: ConnectionError: ('Connection aborted.','Connection reset by peer')) 。我不确定 Google Colab 是否可以做到这一点。

希望有人能帮助我。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。