eventlet.monkey_patch原因:SSL.Py

问题描述 投票:0回答:1
在python 3.10.9 docker容器中,该应用取决于一个关键软件包,使用了

eventlet.monkey_patch(socket=True)

。不幸的是,这是因为
RecursionError: maximum recursion depth exceeded
代码段
requests.Session().get()

有任何可能的方法使

import requests from requests.adapters import HTTPAdapter s = requests.Session() s.mount('https://', HTTPAdapter(pool_connections=2)) s.get('https://stackoverflow.com/questions/34837026/whats-the-meaning-of-pool-connections-in-requests-adapters-httpadapter') # <Response [200]> import eventlet eventlet.monkey_patch(socket=True) s.get('https://stackoverflow.com/questions/34837026/whats-the-meaning-of-pool-connections-in-requests-adapters-httpadapter') # <Response [200]> s.get('https://www.google.com/') # RecursionError: maximum recursion depth exceeded s.get('https://stackoverflow.com/questions/34837026/whats-the-meaning-of-pool-connections-in-requests-adapters-httpadapter') # <Response [200]>
用修补
urllib3.HTTPSConnection.connect(self)

socket
。
我发现唯一的窍门是在应用monkey_patch之前热身连接池。
我必须与

eventlet.monkey_patch(socket=True)

打交道。它不是用

gevent

或重写替换的选项。

	
也是一个类似的问题。
问题是我猴子修补了太晚。
猴子补丁应该是您要做的第一件事(在导入请求之前)

python connection-pooling monkeypatching
1个回答
0
投票
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.