写了一个小爬虫 遇到了两个关于 requests 和 openssl 的问题

2016-12-21 14:30:17 +08:00
 Anhedonia
最近想写一个爬虫 用来去 ehentai 爬本子玩
结果发现 requests.get 这个方法在爬 url 的时候会报错

requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(54, 'Connection reset by peer'))

在网上查了一下 有人说是关于 OS X 自带的 openssl 版本太旧的关系
于是用 homebrew 去更新 openssl 结果在 link 的时候又爆出了错误
Linking keg-only openssl means you may end up linking against the insecure,
deprecated system OpenSSL while using the headers from Homebrew's openssl.
Instead, pass the full include/library paths to your compiler e.g.:
-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib

请问 1.requests 的问题跟 openssl 有关系么?
2.openssl 更新的问题怎么解决呀
10839 次点击
所在节点    Python
28 条回复
janxin
2016-12-22 09:24:52 +08:00
e 绅士是翻墙问题不是 openssl 问题
Anhedonia
2016-12-22 16:59:07 +08:00
@janxin 嗷嗷嗷懂了懂了
那可能确实是我代理没做好
Anhedonia
2016-12-22 18:23:46 +08:00
@janxin
@Sylv
设置了代理之后好了
但是 还是有问题
![]( )
Anhedonia
2016-12-22 18:44:35 +08:00
@janxin
@Sylv
好吧我发现了
我 URL 改谷歌也爬不了
可能还是代理的锅
Anhedonia
2016-12-22 18:50:40 +08:00
@janxin
@Sylv
谢谢!
我终于成功了
qwer1234asdf
2016-12-22 20:14:22 +08:00
有个粗暴的办法,先用浏览器打开你要的页面,然后 f12 看 request 的信息, chrome 有个选项可以把请求需要的所有东西拷贝成 curl 的格式,然后 curl 就可以了……
mingyun
2016-12-22 23:31:43 +08:00
Anhedonia
2016-12-23 20:49:59 +08:00
@qwer1234asdf 简单粗暴啊!

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/329155

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX