Home > Net >  Python requests not working due to Fiddler
Python requests not working due to Fiddler

Time:07-02

When I use fiddler any request using python fails, pip doesn't work either.

ValueError: check_hostname requires server_hostname

What can I do about it?

CodePudding user response:

This happens because you are trying to connect using https. Even if you manage to connect, you would need to load local SSL certificates to authenticate the connection when Fiddler is active (Fiddler provides you a guide on how to do this with a browser). To bypass all this, use the proxy fiddler is listening on and disable certificate check. For example, using requests:

import requests

# Default proxy for Fiddler
proxies = {'http': 'http://127.0.0.1:8888',
           'https': 'http://127.0.0.1:8888'}

print(requests.get('https://google.com', proxies=proxies, verify=False).status_code)

Output

200
  • Related