gpt4 book ai didi

python - GRequests 猴子补丁警告

转载 作者:行者123 更新时间:2023-11-30 21:55:41 36 4
gpt4 key购买 nike

尽管模块按预期工作,但我每次都会收到以下警告:

/usr/local/lib/python3.7/site-packages/grequests.py:21: MonkeyPatchWarning: Monkey-patching ssl after ssl has already been imported may lead to errors, including RecursionError on Python 3.6. It may also silently lead to incorrect behaviour on Python 3.7. Please monkey-patch earlier. See https://github.com/gevent/gevent/issues/1016. Modules that had direct imports (NOT patched): ['urllib3.util (/usr/local/lib/python3.7/site-packages/urllib3/util/__init__.py)', 'urllib3.contrib.pyopenssl (/usr/local/lib/python3.7/site-packages/urllib3/contrib/pyopenssl.py)']. 
curious_george.patch_all(thread=False, select=False)

我尝试了 this github issue 中提到的解决方法但这行不通。

如何消除这个警告?

最佳答案

对于grequests,您需要在其他模块尝试导入/加载 gevent 和 ssl 之前添加以下代码:

from gevent import monkey as curious_george
curious_george.patch_all(thread=False, select=False)

关于python - GRequests 猴子补丁警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56309763/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com