python gevent MonkeyPatchWarning: Monkey-patching ssl after
2020-12-13 02:12
标签:spawn pre hub key rgs www warning get 解决方法 MonkeyPatchWarning: Monkey-patching ssl after 报错原因: 导入包的顺序不正确; 解决: 正确顺序如下: 完整示例: 参考别人的解决方法:https://blog.csdn.net/baidu_24536755/article/details/80712903 python gevent MonkeyPatchWarning: Monkey-patching ssl after 标签:spawn pre hub key rgs www warning get 解决方法 原文地址:https://www.cnblogs.com/xhzd/p/11028550.htmlimport gevent
from gevent import monkey
monkey.patch_all()
import requests
import gevent
from gevent import monkey
monkey.patch_all()
import requests
def task(method, url, req_kwargs):
print(method, url, req_kwargs)
response = requests.request(method=method, url=url, **req_kwargs)
print(response.url, response.content)
# ##### 发送请求 #####
gevent.joinall([
gevent.spawn(task, method=‘get‘, url=‘https://www.python.org/‘, req_kwargs={}),
gevent.spawn(task, method=‘get‘, url=‘https://www.yahoo.com/‘, req_kwargs={}),
gevent.spawn(task, method=‘get‘, url=‘https://github.com/‘, req_kwargs={}),
])
# ##### 发送请求(协程池控制最大协程数量) #####
# from gevent.pool import Pool
# pool = Pool(5)
# gevent.joinall([
# pool.spawn(task, method=‘get‘, url=‘https://www.python.org/‘, req_kwargs={}),
# pool.spawn(task, method=‘get‘, url=‘https://www.yahoo.com/‘, req_kwargs={}),
# pool.spawn(task, method=‘get‘, url=‘https://www.github.com/‘, req_kwargs={}),
# ])
上一篇:hornetq 入门(1)
下一篇:js 函数定义三种方式
文章标题:python gevent MonkeyPatchWarning: Monkey-patching ssl after
文章链接:http://soscw.com/essay/25104.html