解决办法: 将requests2.26.0改为requests2.23.0, 降低版本
个人是在django中调用requests, get请求,第一次没问题,以后就会出现下方图片的错误,
由于我用的是django-vue-admin这个框架,找源码,看到某个地方用到了
try:
eventlet.monkey_patch(thread=False) # 必须加这条代码
with eventlet.Timeout(2, False): # 设置超时时间为2秒
apiurl = "http://whois.pconline.com.cn/ip.jsp?ip=%s" % request_ip
r = requests.get(apiurl)
content = r.content.decode("GBK")
location = str(content).replace("\r", "").replace("\n", "")[:64]
if getattr(settings, "REDIS_ENABLE", False):
cache.set(request_ip, location, 86400)
return location
except Exception as e:
pass
return ""
遂修改,不管用, 百度,看到有人说改递归深度,觉得不可能,很麻烦,最后,看到某个贴子说了一个类似的错误,降低版本就好了,试了一下,完美!