hass_mifi/getPage.py

15 lines
412 B
Python
Raw Permalink Normal View History

2020-03-07 12:49:38 -05:00
import dryscrape
from bs4 import BeautifulSoup
dryscrape.start_xvfb()
session = dryscrape.Session()
2020-05-01 09:48:26 -04:00
session.set_header("User-Agent", "Mozilla/5.0 (Windows NT 5.1; rv:41.0) Gecko/20100101 Firefox/41.0")
session.visit('http://192.168.7.1')
2020-03-07 12:49:38 -05:00
response = session.body()
soup = BeautifulSoup(response,features="lxml")
print(soup)
#soup.find(id="intro-text")
# Result:
#<p id="intro-text">Yay! Supports javascript</p>