0

I'm trying to send requests to an HTTPS website behind corporate proxy that requires authentication.

The below code works:

import requests
import urllib

requests.get('https://google.com',
             proxies={
                 'http': 'http://myusername:mypassword@10.20.30.40:8080',
                 'https': 'http://myusername:mypassword@10.20.30.40:8080'
             },
             verify=False)

but I want to avoid hardcoding the username and password in the script file, especially that we have to reset our passwords every 60 days. I need it to automatically authenticate as the logged-in Windows user, same behavior as a browser.

I looked online and learned that this is not possible through requests (1, 2, 3, 4) and I would have to resort to something like pycurl or px but all examples online had username and password provided explicitly. There was also this solution utilizing win32com.client but I have no idea how to use this in place of requests.

0 Answers0