collinsanele

request_html for js rendered pages in py

Nov 23rd, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. from requests_html import HTMLSession
  2. session = HTMLSession(browser_args=["--no-sandbox", '--user-agent=Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1'])
  3. r = session.get('https://register.epo.org/application?number=EP16190441&lng=en&tab=federated')
  4. # This is necessary for your webpage in particular because it takes around 13 seconds for the page to load.
  5. r.html.render(timeout=15)
  6. print(r.html.text)
Add Comment
Please, Sign In to add comment