May-12-2018, 11:12 AM
When I try to run my script I get a syntax error. Can anyone please tell me what's wrong?
The whole script is as follows:
Error:pi@raspberrypi:~/Desktop $ python TONotificationScript.py
File "TONotificationScript.py", line 11
with requests.get('https://tradeogre.com/api/v1/account/balances', auth=HTTPBasicAuth('***', '***') as response:
^
SyntaxError: invalid syntax
(the API keys are not valid)The whole script is as follows:
import requests import time from playsound import playsound oldData = None while True: with requests.get('https://tradeogre.com/api/v1/account/balances', auth=HTTPBasicAuth('***', '***') as response: newData = response.read() if oldData is not None and newData != oldData: print('Change detected on TO') playsound('./Desktop/DEFCON level change.mp3') r = requests.post("https://api.pushover.net/1/messages.json", data = { "token": "***", "user": "***", "message": "Change detected on TO" }, ) print(r.text) oldData = newData time.sleep(300)