I can generate an authentication token as described here:
https://stackoverflow.com/a/141729/2177047
import win32security
token = win32security.LogonUser(
username,
domain,
password,
win32security.LOGON32_LOGON_NETWORK,
win32security.LOGON32_PROVIDER_DEFAULT)
authenticated = bool(token)
Now I want to emulate an authenticated user who sends requests using his browser as shown here:
https://stackoverflow.com/a/73662823/2177047
import requests
url='https://www.google.com/search?q=hello+world'
headers = {"User-Agent": "Mozilla/5.0", "accept-language": "en-US,en"}
print(requests.get(url,headers=headers).status_code)
How can I pass the generated token to the requests library?
The API I want to send requests to requires azure authentication.