title: What specifically should the domain be for NTLM authentication when using python-requests library?
body: <p>I am currently trying to access a sharepoint's API via python and the requests library. After inspecting the request via firebug I determined that it was using NTLM authentication so I installed the requests_ntlm plugin but I'm still getting a 401 error. </p>
  
  <p>I came across this post, <a href="https://stackoverflow.com/questions/20945822/how-to-access-a-sharepoint-site-via-the-rest-api-in-python">How to access a sharepoint site via the REST API in Python?</a>, where the solution to use NTLM auth is this:</p>
  
  <pre><code>requests.get("http://sharepoint-site.com", auth=HttpNtlmAuth('DOMAIN\\USERNAME','PASSWORD'))
  </code></pre>
  
  <p>I am just confused by what domain is supposed to reference. I assumed it would just be my site_url but that still doesn't work. I've tried formatting it with two forward slashes as shown on the thread but also as one backslash as referenced here: <a href="https://curl.haxx.se/mail/lib-2005-11/0086.html" rel="noreferrer">https://curl.haxx.se/mail/lib-2005-11/0086.html</a>.</p>
  
  <blockquote>
    <p>When using NTLM, you can set domain by prepending it to the user 
           name and separating the domain and name with a forward (/) or 
           backward slash (\). Like this: "domain/user:password" or 
           "domain\user:password". Some HTTP servers (on Windows) support 
           this style even for Basic authentication. </p>
  </blockquote>
  
  <pre><code>import requests
  from requests_ntlm import HttpNtlmAuth
  
  username = "user"
  password = "pass"
  site_url = "https://sharepoint.site.com/foo/"
  r = requests.get(site_url, auth=HttpNtlmAuth(site_url + username, password)
  print(r.status_code)
  </code></pre>
  
  <p>I just find it interesting that it gives an explicit sample url in the request.get, but just gives the arbitrary "DOMAIN" in the auth parameter. The same goes for the documentation for the request-ntlm library seen here: <a href="https://github.com/requests/requests-ntlm" rel="noreferrer">https://github.com/requests/requests-ntlm</a>:  </p>
  
  <pre><code>requests.get("http://ntlm_protected_site.com",auth=HttpNtlmAuth('domain\\username','password'))
  </code></pre>
  
  <p>I'm guessing I just have the syntax messed up for the user name but I'm not quite sure the problem. </p>