Handling Windows Authentication When Accessing a URL Using Requests

I am using python query library to access soap requests. And it worked fine. Because changes are taking place in our domain structure. I was unable to access the URL, so I always suggested entering credentials.

enter image description here

I use below code to access url before using requests.

program_list_response = requests.get(program_list_path,
                                                 data=self.body, headers=self.headers)

How to pass authentication in the background using requests?

+4
source share
1 answer

You can use the Authentication function to provide credentials for the link you want to access.

For example:

, :

requests.get('https://website.com/user', auth=('user', 'pass'))

.

Windows Requests-NTLM.

,

import requests
from requests_ntlm import HttpNtlmAuth

requests.get("http://ntlm_protected_site.com",auth=HttpNtlmAuth('domain\\username','password'))
+12