haechang
haechang

Reputation: 11

HTTPS using a proxy server with requests python 3.x

I want requests using proxy, but the following errors occur.

requests.exceptions.ProxyError: HTTPSConnectionPool(host='URL', port=443): Max retries exceeded with url: / (Caused by ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory')))

I tried downgrading the version of urlib3 to 1.25.3, and the same error continues to occur even though I tried the proxy setting as below.

proxies = [{
    'http' : 'http://ip:port',
    'https' : 'http://ip:port'
}]

&&&&&

proxies = [{
    'http' : 'http://ip:port',
    'https' : 'https://ip:port'
}]

False value is also given to the verify option, but errors continue to occur. Can you tell me the solution?

When I searched, I heard that my proxy ip does not support https communication. Is this right?

Upvotes: 1

Views: 615

Answers (1)

Mạnh Hùng Chu
Mạnh Hùng Chu

Reputation: 61

proxies = {
        'http': 'http://user_name:password@ip:port',
        'https': 'http://user_name:password@ip:port'
    }
r = requests.get(URL, proxies=proxies)

Upvotes: 1

Related Questions