title: Python requests login fails, even with cookies
body: <p>I'm having trouble logging into a website to scrape pages behind login permissions (which I have). I've tried a number of fixes, including using the Requests module (including csrf tokens and hidden tags) and using the BrowserCookie module to try to use cookies from a browser login session. However, nothing seems to work. In the example below, I used a simple requests session. The site returns a 200 code, which supposedly signifies a successful login, but the page redirects back to the login page. Is there anything else I'm missing or is it possible that the website blocks webscrapers from logging in?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>import requests
  from bs4 import BeautifulSoup as bs
  
  payload = {
      "UserName":"&lt;user&gt;",
      "Password":"&lt;pass&gt;"
  }
  
  
  s = requests.Session()
  r1=s.post("http://&lt;webpage&gt;/login", data=payload)
  
  
  
  if r1.status_code == 200:
      print("logged in")
      r2=s.get("&lt;url behind login permissions")
      soup=bs(r2.content,'lxml')
      print(soup.title.string) #Redirects to login page</code></pre>
  </div>
  </div>
  </p>