[Python] Authenticate with Windows Credentials in Python

Discussão em 'Python' iniciado por Stack, Abril 8, 2025.

  1. Stack

    Stack Membro Participativo

    I am working on developing an API call which needs to authenticate to a proxy. I have managed to do this by explicitly entering my proxy information. Like so:

    import requests

    proxies = {'https': "https://user:password@proxyIP:port"}

    response = requests.get('www.google.com', proxies=proxies)


    The question is how do I grab the credentials of the currently logged in user and then pass them to the proxy. In my research I have come across this ServerFault post - the answer wasn't helpful but there is another one by shellster which seems to work. However, I cannot make sense of his code.

    I have also install requests_negotiate_sspi (docs) and attempted to leverage the HttpNegotiateAuth module as mentioned here but I cannot seem to figure it out.

    Note: I am using Python 3.7 and am in Windows 7 + 10 Environment.

    EDIT

    This question specifies proxies, however I really need to know how this works for other domain resources, like SharePoint, User Shares, etc.

    There has to be a pythonic way to accomplish this!

    Continue reading...

Compartilhe esta Página