title: Get location from response header
body: <p>I am trying to get the <code>Location</code> value from a <code>POST</code> request using python's requests module. However, when I look at the response's headers, I don't see any such key. Performing the same request using Google Chrome does show the key.</p>
  
  <p>This is where I am trying to download data from: <a href="https://data.police.uk/data" rel="nofollow">https://data.police.uk/data</a>
  . Launch this in Google Chrome and open the Developer Tools. When you select a date range, select some force and click <code>Generate File</code>, you can see a <code>POST</code> request being made with a <code>Location</code> key in the Response header.</p>
  
  <pre><code>import requests
  from urlparse import urlparse, urljoin
  
  BASE = 'https://data.police.uk'
  FORM_PATH = 'data'
  
  form_url = urljoin(BASE, FORM_PATH)
  
  # Get data download URL
  client = requests.session()
  try:
      client.get(form_url)
  except requests.exceptions.ConnectionError as e:
      print (e)
      sys.exit()
  
  csrftoken = client.cookies.values()
  
  l = [('forces', 'cleveland')]
  t = ('csrfmiddlewaretoken', csrftoken[0])
  
  d_from = ('date_from', '2014-05')
  d_to = ('date_to', '2016-05')
  l.extend((t, d_from, d_to))
  
  r = client.post(form_url, headers=dict(Referer=form_url), data=l)
  </code></pre>
  
  <p>Querying the response headers gives me:</p>
  
  <pre><code>In [4]: r.headers
  Out[4]: {'Content-Length': '4332', 'Content-Language': 'en-gb', 'Content-Encoding': 'gzip', 'Set-Cookie': 'csrftoken=aGQ7kO4tQ2cPD0Fp2svxxYBRe4rAk0kw; expires=Thu, 03-Aug-2017 22:11:44 GMT; Max-Age=31449600; Path=/', 'Vary': 'Cookie, Accept-Language', 'Server': 'nginx', 'Connection': 'keep-alive', 'Date': 'Thu, 04 Aug 2016 22:11:44 GMT', 'Content-Type': 'text/html; charset=utf-8'}
  </code></pre>
  
  <p>Question: How do I get the <code>Location</code> key from the response header?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Answer: Had to specify <code>l.append(['include_crime', 'on'])</code>. Works after this.</p>