Skip to content

Instantly share code, notes, and snippets.

@smrati
Created January 25, 2020 07:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smrati/2a0f4de99f4d95f9fd0855357666aa07 to your computer and use it in GitHub Desktop.
Save smrati/2a0f4de99f4d95f9fd0855357666aa07 to your computer and use it in GitHub Desktop.
MechanicalSoup Basic Tutorial
import mechanicalsoup
user_agent_string = 'Mozilla/5.0 (X11; CrOS x86_64 8172.45.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.64 Safari/537.36'
browser = mechanicalsoup.StatefulBrowser(user_agent=user_agent_string, )
browser.open('https://ebootcamp.dev')
headings_list = browser.get_current_page().find_all('h3')
for heading in headings_list:
print(heading.text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment