title: python - Save HTML from browser
body: <p>I have my own local HTML file open in my browser. When I click a certain button, the class to the button changes to "selected." What I want to do is have Python take the current updated HTML of the file in the browser and overwrite it as the original HTML file. The goal here is to save the changes that were updated from the browser as the new HTML file, so the next time I open this file, the changes don't need to be made again.</p>
  
  <p>Typically I would: </p>
  
  <ol>
  <li>send an HTTP request to a url</li>
  <li>turn the response into a BeautifulSoup object</li>
  <li><p>then save it as a string as <code>myfile.html</code></p>
  
  <pre><code>url = 'http://google.com'
  r = requests.get(url)
  soup = str(BeautifulSoup(r.content,'lxml'))
  file.write(soup)
  </code></pre></li>
  </ol>
  
  <p>But I cannot send an HTTP request because it's a file currently open in my browser, not a web page on a server to be requested. So I'm not sure how to receive the structured HTML into Python for further processing.</p>