I am trying to login to a site using python requests. Normally I do this using curl in the cmd.
curl -c <path/urs_cookies.txt> -n -L https://site_FileUpload/login
Where the -n searches for the .netrc file in the cwd which contains my username and password.
However doing this in python using does not work
login = requests.get(url, auth=(username, password))
I believe this is because I need to use my .netrc file instead of using the authorisation method.
Is there anyway I can attach this file to my login request?
Thanks a lot
If your .netrc file exists in your home directory, python requests will automatically check that file for credentials under a given machine (hostname) when the auth argument is not provided.
From the requests documentation: https://requests.readthedocs.io/en/latest/user/authentication/?highlight=.netrc#netrc-authentication
The following should work assuming you have a valid .netrc file in your home directory. https://www.labkey.org/Documentation/wiki-page.view?name=netrc