问题描述
我正在 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 (将#修改为@)