Quantcast
Channel: Active questions tagged https - Stack Overflow
Viewing all articles
Browse latest Browse all 1584

How to fix "ProxyError: Cannot connect to proxy, Tunnel connection failed: 403 Forbidden" when making a request in Python using requests library?

$
0
0

I am working on my pet project and have chosen www.pythonanywhere.com for hosting

to implement some functionality, I need to take information from sitesbut when I execute the following code

import requestsresponse = requests.get("https://example.com",         proxies={"http":"http://162.120.71.11:80"},         headers={"User-Agent": "Opera/9.80 (X11; Linux x86_64; U; de) Presto/2.2.15 Version/10.00"}        )print( response.text )

I'm getting an error

raise ProxyError(e, request=request)requests.exceptions.ProxyError: HTTPSConnectionPool(host='example.com', port=443): Max retries exceeded with url: / (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden')))

I tried changing user agents and proxies but nothing changed

and also I tried to make a request to different sites and for some sites it worked but not for those that I need


Viewing all articles
Browse latest Browse all 1584

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>