_html.py 461 B

123456789101112131415161718
  1. import requests
  2. """
  3. This module contains methods to retrieve pages
  4. """
  5. def get_page(this_url):
  6. """
  7. Simple utility gets the contents of a webpage
  8. @TODO Add Try/Catch blocks. Handle http errors.
  9. :param this_url:
  10. :return:
  11. """
  12. headers = {'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36'}
  13. data = requests.get(this_url, headers=headers)
  14. return data.text