Answer the question
In order to leave comments, you need to log in
How to use proxy with authorization in Python requests?
I'm trying to access a site using a proxy (free for now). But for some reason an error pops up. What am I doing wrong?
Here is the code:
import requests
from requests.auth import HTTPProxyAuth
URL = 'https://www.avito.ru'
PROXY_URLS = {
'https': '185.168.250.121:8000',
'http': '185.168.250.121:8000',
}
AUTH = HTTPProxyAuth('H53R8g', 'NHpB4w')
response = requests.get(URL, proxies=PROXY_URLS, auth=AUTH)
requests.exceptions.ProxyError: HTTPSConnectionPool(host='www.avito.ru', port=443): Max retries exceeded with url: / (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required')))
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question