Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

requests library not working while mitm proxy enabled #4572

Closed
mcg88 opened this issue Apr 21, 2021 · 6 comments
Closed

requests library not working while mitm proxy enabled #4572

mcg88 opened this issue Apr 21, 2021 · 6 comments
Labels
kind/triage Unclassified issues

Comments

@mcg88
Copy link

mcg88 commented Apr 21, 2021

Problem Description

Can't use requests library in script, throws following error:

in script mitm.py: HTTPSConnectionPool(host='www.google.com', port=443): Max retries exceeded with url: / (Caused by ProxyError('Cannot connect to proxy.', timeout('_ssl.c:1034: The handshake operation timed out')))

Any idea how I can resolve this?

@mcg88 mcg88 added the kind/triage Unclassified issues label Apr 21, 2021
@Prinzhorn
Copy link
Member

Please share some code that reproduces the problem, otherwise we can only make guesses.

@mcg88
Copy link
Author

mcg88 commented Apr 23, 2021

class WsLog:
	def __init__(self):
		print('starting WSLogger')

		a = requests.get('https://www.google.com/', timeout=5)

		print('request done')

addons = [
	WsLog()
]

@Prinzhorn
Copy link
Member

Here's what I'm seeing for both mitmdump 6.0.2 and 7.0.0-dev:

import requests

class WsLog:
  def __init__(self):
    print('starting WSLogger')

    a = requests.get('https://www.google.com/', timeout=5)
    print(a)

    print('request done')

addons = [
  WsLog()
]
mitmdump --quiet --scripts req.py 
starting WSLogger
<Response [200]>
request done

@Prinzhorn
Copy link
Member

I'm going to close this. If you believe this is a bug in mitmproxy then please provide clear steps to reproduce it and re-open the issue.

@xwqiang
Copy link

xwqiang commented Mar 29, 2022

I have the same problem and can't reproduce it immediately,it occured hours after proxy started.

@Prinzhorn
Copy link
Member

it occured

What occurred? It's entirely normal for networks to fail occasionally or for Google (or your endpoint) to go down for a brief moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/triage Unclassified issues
Projects
None yet
Development

No branches or pull requests

3 participants