title: Scraping JavaScript page with python requests and asyncio in Jupyter notebook
body: <p><strong>This is far from duplicate of <a href="https://stackoverflow.com/questions/39757805/using-python-requests-and-beautiful-soup-to-pull-text">this</a> question</strong> since that question doesn't even use requests for scraping but only for session and getting page content. I use it as well in such manner with Beautiful Soup.</p>
  <p>I have also tried <a href="https://stackoverflow.com/questions/8049520/web-scraping-javascript-page-with-python">this</a>. But they also didn't explain how to use requests effectively for getting JavaScript content.</p>
  <p>I'm trying to scrape info from web page which is rendered by JavaScript code. I'm using <code>requests</code> module in Jupyter notebook which.</p>
  <p>When I use following sample code:</p>
  <pre><code>import asyncio
  from requests_html import AsyncHTMLSession
  asession = AsyncHTMLSession()
  
  r = await asession.get('http://python-requests.org')
  r.html.render()
  r.html.search('Python 2 will retire in only {months} months!')['months']
  </code></pre>
  <p>I get error:</p>
  <blockquote>
  <p>RuntimeError: This event loop is already running</p>
  </blockquote>
  <p>I need some advice on how to implement this <a href="https://github.com/jupyter/notebook/issues/3397#issuecomment-381440076" rel="nofollow noreferrer">comment</a> to make it work since when I type in Jupyter notebook :</p>
  <pre><code>asyncio.get_event_loop()
  </code></pre>
  <p>I get:</p>
  <blockquote>
  <p>&lt;_WindowsSelectorEventLoop <strong>running=True</strong> closed=False debug=False&gt;</p>
  </blockquote>
  <p>so I need way to use existing loop in Jupyter notebook.</p>