title: get the referer url in python/webapp2 for a post request
body: <p>I want to get the referer url that has sent in the request to the server. 
  I am using the webapp2 framework on appengine. </p>
  
  <p>when i do:</p>
  
  <pre><code>def post(self, slug):
      print self.request 
  </code></pre>
  
  <p>i get the following output:</p>
  
  <pre><code>OST /first/person/ HTTP/1.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 Accept-Language: en-US,en;q=0.8 Cache-Control: max-age=0 Connection: keep-alive Content-Length: 43 Content-Type: application/x-www-form-urlencoded Content_Length: 43 Content_Type: application/x-www-form-urlencoded Cookie: djdt=hide; csrftoken=09f29b2bfe9f51f16581bab7fe7c6f38; sessionid=49b995d954eae8d613cedc3f4e92a796 Host: 127.0.0.1:8080 Origin: http://127.0.0.1:8080 Referer: http://127.0.0.1:8080/person/1/ 
  </code></pre>
  
  <p>as is clearly visible there is <code>Referer: http://127.0.0.1:8080/person/1/</code> </p>
  
  <p>i am interested in only the referer, hence i tried: </p>
  
  <pre><code>referer = self.request.headers['Referer']
              print referer
  </code></pre>
  
  <p>which gives the output:</p>
  
  <pre><code>False Status: 200 Content-Type: text/html; charset=utf-8 Content-Length: 0 Cache-Control: no-cache
  </code></pre>
  
  <p>One way of getting would be to do string processing on request, but i am sure there would be something more standard. </p>