Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ItemAlert v4
- #actualizar.py
- import configparser
- import re
- import urllib.request
- import subprocess
- config = configparser.ConfigParser()
- config.read('config.ini')
- midispositivo = config['DISPOSITIVO']['ID']
- url = config['GSHEET']['URL']
- with urllib.request.urlopen(url) as response:
- html = response.read().decode('utf-8')
- regex = r"---.*?--(.*?)--.*?---"
- r1 = re.findall(regex, html)
- adispositivo = r1[0]
- aactualizar = r1[1]
- aurl = r1[2]
- print (adispositivo)
- print (aactualizar)
- print (aurl)
- if (aactualizar == 'SI'):
- with urllib.request.urlopen(aurl) as response:
- codigo = response.read()
- with open("itemalert.py", "wb") as f:
- f.write(codigo)
- f.close()
- subprocess.call("itemalert.py", shell=True)
- #exec(open("itemalert.py").read())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement