日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

pythonrequests说明_解决Python requests 报错方法集锦

發布時間:2023/12/4 python 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 pythonrequests说明_解决Python requests 报错方法集锦 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

python版本和ssl版本都會導致 requests在請求https網站時候會出一些錯誤,最好使用新版本。

1 Python2.6x use

requests

一臺老Centos機器上跑著古老的應用,加了一個新模塊之后報錯 報錯 InsecurePlatformWarning: A true SSLContext

object is not available.

/usr/lib/python2.6/site-packages/requests/packages/urllib3/util/ssl_.py:132:

InsecurePlatformWarning: A true SSLContext object is not available. This

prevents urllib3 from configuring SSL appropriately and may cause certain SSL

connections to fail. You can upgrade to a newer version of Python to solve this.

For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings

InsecurePlatformWarning

解決辦法

使用老版本的 requests$pip install requests==2.5.3

或者這樣安裝$ pip install requests[security]

2 SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

錯誤如下版本 python2.7.5

Traceback (most recent call last):

File "./test.py", line 24, in

response = requests.get(url1, headers=headers)

File

"build/bdist.linux-x86_64/egg/requests/api.py", line 52, in get

File

"build/bdist.linux-x86_64/egg/requests/api.py", line 40, in request

File

"build/bdist.linux-x86_64/egg/requests/sessions.py", line 209, in request

File "build/bdist.linux-x86_64/egg/requests/models.py", line 624, in send

File "build/bdist.linux-x86_64/egg/requests/models.py", line 300, in

_build_response

File "build/bdist.linux-x86_64/egg/requests/models.py",

line 611, in send

requests.exceptions.SSLError: [Errno 1] _ssl.c:503:

error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify

failed

解決方法

可以禁用 verify>>> requests.get('https://google.com', verify=True)

問題地址

python-requests-throwing-up-sslerror

3 SSLError: bad

handshake

SSLError: bad handshake: Error([(‘SSL routines',

‘SSL3_GET_SERVER_CERTIFICATE', ‘certificate verify failed')],) python2.7.5

解決方法pip uninstall -y certifi && pip install certifi==2015.04.28

原文鏈接:http://blog.csdn.net/orangleliu/article/details/62037768

創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎

總結

以上是生活随笔為你收集整理的pythonrequests说明_解决Python requests 报错方法集锦的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。