title: How to get current URL in python web page?
body: <p>I am a noob in Python. Just installed it, and spent 2 hours googleing how to get to a simple parameter sent in the URL to a Python script</p>
  
  <p>Found <a href="https://stackoverflow.com/questions/5074803/retrieving-parameter-from-url-in-python">this</a></p>
  
  <p>Very helpful, except I cannot for anything in the world to figure out how to replace</p>
  
  <pre><code>import urlparse
  url = 'http://foo.appspot.com/abc?def=ghi'
  parsed = urlparse.urlparse(url)
  print urlparse.parse_qs(parsed.query)['def']
  </code></pre>
  
  <p>With what do I replace url = 'string' to make it work?
  I just want to access <a href="http://site.com/test/test.py?param=abc" rel="noreferrer">http://site.com/test/test.py?param=abc</a> and see abc printed.</p>
  
  <hr>
  
  <p>Final code after Alex's answer: </p>
  
  <pre><code>url = os.environ["REQUEST_URI"] 
  parsed = urlparse.urlparse(url) 
  print urlparse.parse_qs(parsed.query)['param']
  </code></pre>