使用了多进程,调用requests发送请求,报错递归超过最大深度

====================报错信息==========
File "D:\Python36\lib\ssl.py", line 465, in options super(SSLContext, SSLContext).options.__set__(self, value) [Previous line repeated 321 more times] RecursionError: maximum recursion depth exceeded while calling a Python object



==================多进程============

p = Pool(4)
res_list = []
for i in token_list:
res = p.apply_async(create_app_fun, args=(i,))
res_list.append(res)
p.close()
p.join()

======================被掉函数=========
def create_app_fun(token):
url = base_url + WebApi.create_app
data = {}
headers = {'token': token}
res = requests.post(url=url, json=data, headers=headers)
return taskno


 

解决办法:

import gevent        #在requests调用之前先导入gevent
import requests 

https://www.codeleading.com/article/51931110027/

posted @ 2021-12-14 14:30  Tarzen  阅读(763)  评论(0编辑  收藏  举报