6

I am trying to access a website that uses NTLM authentication. I have been successfully able to retrieve the content using the requests library in combination with requests-ntlm. However to use that I have to provide both username and password in the code or as an input from the user.

If I access the same site in any of my browsers I am not asked for anything, it just works. How can I avoid the need to enter the password using python ?

Zitrax
  • 19,036
  • 20
  • 88
  • 110
  • 1
    I'm not sure what your question is : Do you need to avoid entering passwords on the shell ? or during the request you want to "fill the form" automatically ? Do you need to avoid storing the password in hardcoded version ? – Jiby Sep 09 '15 at 12:16
  • I would want to avoid any password in the code or from the shell. Since the OS (using Chrome, Vivaldi, IE) is able to access the site without any input I assume that should in theory be possible from python too; I am just not sure how. – Zitrax Sep 09 '15 at 12:23
  • Maybe the user authentication has been recorded by the website in a browser cookie - have you tried clearing all browser cookies and then accessing the website? A brief search for: _authentication ntlm browser_ turns up this: http://sivel.net/2007/05/firefox-ntlm-sso/ describing in fact how browser config can make it automatically authenticate with your Windows username/password. – DisappointedByUnaccountableMod Sep 09 '15 at 12:48
  • @barny right so maybe Firefox does need some tweaking, I didn't try it. But the ones I tried worked also after clearing all data. But what you linked to hints that the browser autologin is called ntlm sso then. – Zitrax Sep 09 '15 at 12:57
  • I strongly suspect the simplest solution might be to implement your app within your browser, e.g. in javascript/websockets(?). – DisappointedByUnaccountableMod Sep 09 '15 at 13:03
  • See https://stackoverflow.com/a/54343596/851737 – schlamar Jan 24 '19 at 09:47

0 Answers0