Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from bs4 import BeautifulSoup
- import urllib3
- import serial
- import sys
- s = None
- try:
- s = serial.Serial('/dev/ttyACM0', 9600)
- except e as Exception:
- print('Could no connect', e)
- sys.exit(1)
- page = "https://koronavirus.gov.hu"
- http = urllib3.PoolManager()
- text = http.request('GET', page)
- soup = BeautifulSoup(text.data.decode('utf-8'), 'html.parser')
- infected_div = soup.find('div', attrs={'class': 'views-row-1'})
- inf_text = infected_div.findChildren('span', attrs={'class': 'number'})[0].text
- print(inf_text)
- s.write((inf_text + '_').encode('ascii'))
- s.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement