Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am trying to make requests to https endpoints with proxies, but I keep getting a 407 error. When I try the same request on an http endpoint, it works without any errors. I'm not sure what I'm doing wrong.

curl -x ip:port-U user:pass https://api.ipify.org/?format=json

My curl request above works fine meaning my proxy is functional.

class Driver:
    def __init__(self, proxy):
        self.proxy = proxy
        self.ses = requests.Session()
        self.ses.proxies = {'https':'https://user:pass@ip:port'}

        response = self.ses.get('https://api.ipify.org/?format=json')
        print(response.text)

Error:

requests.exceptions.ProxyError: HTTPSConnectionPool(host='api.ipify.org', port=443): Max retries exceeded with url: /?format=json (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Invalid Auth')))
question from:https://stackoverflow.com/questions/65867749/invalid-auth-error-when-making-requests-to-https-endpoints

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
933 views
Welcome To Ask or Share your Answers For Others

1 Answer

Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...