如何解决Python-Request-尝试请求网站数据时接收指针错误
我当前正在使用Python 3.7.6,在Jupyter Notebook中运行代码,并尝试通过使用库“ request”来检索网站的数据,但是我收到了Pointer错误-
代码:
from bs4 import BeautifulSoup
import requests
source = requests.get('http://bvmf.bmfbovespa.com.br/indices/ResumoCarteiraTeorica.aspx?Indice=IBOV&idioma=pt-br').text
错误:
OSError: [WinError 10014] - The system detected an invalid pointer address in attempting to use a pointer argument in a call
[...]
NewConnectionError: <urllib3.connection.HTTPConnection object at 0x00000179055507C8>: Failed to establish a new connection: [WinError 10014] The system detected an invalid pointer address in attempting to use a pointer argument in a call
[...]
MaxRetryError: HTTPConnectionPool(host='bvmf.bmfbovespa.com.br.x.ecf9251d0725104833087180eb40dc1a5570.9270ee5e.id.opendns.com',port=80): Max retries exceeded with url: /h/bvmf.bmfbovespa.com.br/indices/ResumoCarteiraTeorica.aspx?X-OpenDNS-Session=_ecf9251d0725104833087180eb40dc1a55709270ee5e_JPweB49M_Indice=IBOV&idioma=pt-br (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x00000179055507C8>: Failed to establish a new connection: [WinError 10014] The system detected an invalid pointer address in attempting to use a pointer argument in a call'))
[...]
ConnectionError: HTTPConnectionPool(host='bvmf.bmfbovespa.com.br.x.ecf9251d0725104833087180eb40dc1a5570.9270ee5e.id.opendns.com',port=80): Max retries exceeded with url: /h/bvmf.bmfbovespa.com.br/indices/ResumoCarteiraTeorica.aspx?X-OpenDNS-Session=_ecf9251d0725104833087180eb40dc1a55709270ee5e_JPweB49M_Indice=IBOV&idioma=pt-br (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x00000179055507C8>: Failed to establish a new connection: [WinError 10014] The system detected an invalid pointer address in attempting to use a pointer argument in a call'))
注意:当我尝试在个人计算机上运行完全相同的代码时,它可以工作,但是,当我尝试在我的工作中运行时,它却无法工作。
解决方法
这实际上是一个代理问题。 在代码中进行了以下更改之后,我可以访问网站的内容-
(lldb) expression context?.fill(CGRect(x: 0,y: 0,width: 5,height: 5))
error: Execution was interrupted,reason: EXC_BAD_ACCESS (code=2,address=0x7b08000c7ff0).
The process has been returned to the state before expression evaluation.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。