title: Need help about sending variable from chrome extension to python
body: <p>i wanted to make a small script that download &quot;maps&quot; automatically when the user open the ingame link.
  Once the link Open in chrome, the extension get the current URL and send it to python(this is where i'm stuck right now) and then close the tab if successful (since it will fail if the python script isn't running?).
  once in python i then proceed to download the map in question and add it to the Songs folder where the only thing he will to do is push F5</p>
  <p>right now, i have these pieces of code:</p>
  <p>Manifest.json:</p>
  <pre class="lang-json prettyprint-override"><code>{
      &quot;name&quot;: &quot;Osu!AltDownload&quot;,
      &quot;version&quot;: &quot;1.0&quot;,
      &quot;description&quot;: &quot;A requirement to make osu!AltDownload work&quot;,
      &quot;permissions&quot;: [&quot;tabs&quot;,&quot;http://localhost:5000/&quot;],
      &quot;background&quot;: {
          &quot;scripts&quot;: [&quot;Osu!AltDownload.js&quot;],
          &quot;persistant&quot;: false
      },
      &quot;manifest_version&quot;: 2
  }
  </code></pre>
  <p>Osu!AltDownload.js</p>
  <pre class="lang-js prettyprint-override"><code>chrome.tabs.onUpdated.addListener( function (tabId, changeInfo, tab) {
      if (changeInfo.status == 'complete') {
          chrome.tabs.query({active: true, currentWindow: true}, tabs =&gt; {
          let url = tabs[0].url;
          });
          var xhr = new XMLHttpRequest();
          xhr.open(&quot;POST&quot;, &quot;http://localhost:5000/&quot;,true);
          xhr.send(url); 
      }
  })
  </code></pre>
  <p>The script that receive the links and download  the &quot;maps&quot;:</p>
  <pre class="lang-py prettyprint-override"><code>import browser_cookie3
  import requests
  from bs4 import BeautifulSoup as BS
  import re
  import os
  def maplink(osupath):
      link = link #obtain link from POST ?
      if link.split(&quot;/&quot;,4[:4]) == ['https:', '', 'osu.ppy.sh', 'beatmapsets']:
          Download_map(osupath, link.split(&quot;#osu&quot;)[0])
  
  def Download_map(osupath, link):
      cj = browser_cookie3.load()
      print(&quot;Downloading&quot;, link)
      headers = {&quot;referer&quot;: link}
      with requests.get(link) as r:
          t = BS(r.text, 'html.parser').title.text.split(&quot;·&quot;)[0]
      with requests.get(link+&quot;/download&quot;, stream=True, cookies=cj, headers=headers) as r:
          if r.status_code == 200:
          try:
              id = re.sub(&quot;[^0-9]&quot;, &quot;&quot;, link)
              with open(os.path.abspath(osupath+&quot;/Songs/&quot;+id+&quot; &quot;+t+&quot;.osz&quot;), &quot;wb&quot;) as otp:
                  otp.write(r.content)
          except:
              print(&quot;You either aren't connected on osu!'s website or you're limited by the API, in which case you now have to wait 1h and then try again.&quot;)
  </code></pre>
  <p>i would like to add in that i used these lines of codes in my extension:</p>
  <pre class="lang-js prettyprint-override"><code>var xhr = new XMLHttpRequest();
  xhr.open(&quot;POST&quot;, &quot;http://localhost:5000/&quot;,true);
  xhr.send(url);
  </code></pre>
  <p>they come from one of my google searches but i don't really understand how i can handle POST request in python with that and i don't even know if i going the right way.</p>
  <p>Some may say i haven't done much research at this subject but out of about 50 chrome tabs, i haven't really found anything that would really give me an idea of the right approach for this subject.</p>