title: Get parameters of an URL in python when rendering a notebook with voila
body: <p>I would like to parse all the parameters and query string of an URL rendered with voila python:</p>
  <p><a href="https://flyingcars.org/john/voila/render/shared/users/john/lrn_url.ipynb?dossier=SA12345678&amp;autorun=True&amp;name=jose&amp;dossier=SA123445#%7Bwhatever=%27no%27,other=%27UK%27%7D" rel="nofollow noreferrer">https://flyingcars.org/john/voila/render/shared/users/john/lrn_url.ipynb?dossier=SA12345678&amp;autorun=True&amp;name=jose&amp;dossier=SA123445#{whatever='no',other='UK'}</a></p>
  <p>So far I have:</p>
  <pre><code>URL_BASE = os.environ.get('SCRIPT_NAME')
  PARAMETERS = os.environ.get(&quot;QUERY_STRING&quot;)
  print(f'{URL_BASE=}')
  print(f'{PARAMETERS=}')
  </code></pre>
  <p>I would get:</p>
  <pre><code>URL_BASE='flyingcars.org/john/voila/render/shared/users/john/lrn_url.ipynb'
  PARAMETERS='dossier=SA12345678&amp;autorun=True&amp;name=john'
  </code></pre>
  <p>but I have two questions:</p>
  <p>a) how to get the rest of the parameters after # in the URL</p>
  <p>b) Is there a standard library to get the query in form of a dictionary</p>
  <p>What i tried:</p>
  <p>I am trying to use cgi module in this way:</p>
  <pre><code>variables  = cgi.FieldStorage()
  variables2 = dict(cgi.FieldStorage())
  ks = cgi.FieldStorage().keys()
  print(f'{ks=}')
  vs = cgi.FieldStorage().values() # error here
  for key in cgi.FieldStorage().keys():
      print(key)
      print(fieldStorage[key].value) # error here
     
  print(f'{variables=}')
  print(f'{variables2=}')
  </code></pre>
  <p>this gives me an error in fieldStorage[key].value, and converting cgi.FieldStorage() into dict() does not work properly.</p>
  <p>And these give errors:</p>
  <pre><code>print(fieldStorage[key].value)
  </code></pre>
  <p>And the previous line</p>
  <pre><code>fieldStorage().values()
  </code></pre>
  <p>Of  I can hack around strings but there might be a straight way to get the variables in a dict with cgi.
  In cgi I can not get a way to get the parameters beyond the # symbol in the URL.</p>
  <p>Thanks</p>