title: How to access a sharepoint site via the REST API in Python?
body: <p>I have the following site in SharePoint 2013 in my local VM:</p>
  
  <p><code>http://win-5a8pp4v402g/sharepoint_test/site_1/</code></p>
  
  <p>When I access this from the browser, it prompts me for the username and password and then works fine. However I am trying to do the same using the REST API in Python. I am using the requests library, and this is what I have done: </p>
  
  <pre><code>import requests
  from requests.auth import HTTPBasicAuth
  
  
  USERNAME = "Administrator"
  
  PASSWORD = "password"
  
  response = requests.get("http://win-5a8pp4v402g/sharepoint_test/site_1/", auth=HTTPBasicAuth(USERNAME, PASSWORD))
  
  print response.status_code
  </code></pre>
  
  <p>However I get a 401. I dont understand. What am I missing?</p>
  
  <p>Note: I followed this article <a href="http://tech.bool.se/using-python-to-request-data-from-sharepoint-via-rest/" rel="noreferrer">http://tech.bool.se/using-python-to-request-data-from-sharepoint-via-rest/</a></p>