kshnkvn
kshnkvn

Reputation: 966

Python requests not working due to Fiddler

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?

Upvotes: -1

Views: 369

Answers (1)

Charchit Agarwal
Charchit Agarwal

Reputation: 3797

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

Upvotes: 2

Related Questions