当我尝试使用报头时,我得到了EOF协议无效错误。当使用proxy,即proxy = {'http':'http://www.blahblah.com'}时,我收到404错误。我正在使用Ubuntu。
我的代码是:
proxy = {'http': 'http://www.blahblah.com'}
r = requests.get(url, headers={'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36'}, proxies = proxy)发布于 2018-08-04 19:04:14
浏览器在尝试建立连接时似乎正在使用扩展的密码列表。对于python,您需要使用DES-CBC3-SHA密码下载此站点:
In [1]: import requests
In [2]: requests.packages.urllib3.util.ssl_.DEFAULT_CIPHERS += ':DES-CBC3-SHA'
In [3]: requests.get('https://www.digitimes.com/index.asp')
Out[3]: <Response [200]>对于curl,您还可以指定此密码:
curl -v --cipher DES-CBC3-SHA https://www.digitimes.com/index.asp或者使用--sslv3 (我已经发现使用--sslv3的DES-CBC3-SHA ):
➜ ~ curl -v --sslv3 https://www.digitimes.com/index.asp
* Trying 122.255.90.243...
* TCP_NODELAY set
* Connected to www.digitimes.com (122.255.90.243) port 443 (#0)
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
* CAfile: /Users/soon/anaconda3/ssl/cacert.pem
CApath: none
* SSLv3 (OUT), TLS handshake, Client hello (1):
* SSLv3 (IN), TLS handshake, Server hello (2):
* SSLv3 (IN), TLS handshake, Certificate (11):
* SSLv3 (IN), TLS handshake, Server finished (14):
* SSLv3 (OUT), TLS handshake, Client key exchange (16):
* SSLv3 (OUT), TLS change cipher, Client hello (1):
* SSLv3 (OUT), TLS handshake, Finished (20):
* SSLv3 (IN), TLS change cipher, Client hello (1):
* SSLv3 (IN), TLS handshake, Finished (20):
* SSL connection using SSLv3 / DES-CBC3-SHA
* ALPN, server did not agree to a protocol
... responsehttps://stackoverflow.com/questions/51684584
复制相似问题