【问题标题】:python-requests and TLSpython请求和TLS
【发布时间】:2012-09-18 21:28:48
【问题描述】:

是否可以使用 TLS 的 requests 包发出请求?

做的时候:

requests.get('someurl')

我明白了:

SSLError: [Errno 8] _ssl.c:491: EOF occurred in violation of protocol

【问题讨论】:

    标签: python ssl python-requests


    【解决方案1】:

    不确定您正在尝试什么网址,但我希望以下内容有所帮助。

    In [35]: url = 'https://www.googleapis.com/freebase/v1/mqlread?query=hello&key=xyz'
    In [36]: requests.request("GET",url)
    Out[36]: <Response [400]>
    

    更多文档请参考here

    【讨论】:

    • 网址为sam.gov(上述方法无效)。我也这样做了:openssl s_client -tls1 -connect www.sam.gov:443 它以 Protocol : TLSv1 响应。我认为它与这个协议有关。我在 Firefox 上也看不到该页面,但在 Chrome 上可以。当我进入 about:config 并打开 TLS 时,我可以看到页面
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-13
    • 1970-01-01
    • 2014-03-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多