Eventlet monkeypatch conflict
Eventlet monkeypatch conflict
$ python -c "import eventlet; eventlet.monkey_patch(); import requests; requests.get('https://example.com')"
Traceback (most recent call last):
...
requests.exceptions.ConnectionError: Green socket/ssl incompatibility
Why this happens
Monkeypatching replaces standard sockets/SSL with green versions that may not fully support urllib3 expectations.
Fix
- Use compatible versions or avoid monkeypatching; try
requestsin threads.
Wrong code
import eventlet
eventlet.monkey_patch()
import requests
requests.get("https://example.com")
Fixed code
import requests
# Avoid global monkeypatch; use standard blocking I/O
resp = requests.get("https://example.com")
print(resp.status_code)