Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
while(True):
r = requests.get(url, headers=headers)
latest = r.json()
chatters = []
for mod in latest['chatters']['moderators']:
chatters.append(mod)
for viewer in latest['chatters']['viewers']:
chatters.append(viewer)
for global_mod in latest['chatters']['global_mods']:
chatters.append(global_mod)
for admin in latest['chatters']['admins']:
chatters.append(admin)
for chatter in chatters:
chatterDbCheck = session.query(db_models.Chatter).filter(
db_models.Chatter.name == chatter).first()
if chatterDbCheck:
chatterDbCheck.currency += 1
chatterDbCheck.totalMinutes += 1
else:
newChatter = db_models.Chatter(
name = chatter,
currency = 1,
totalMinutes = 1,
follower = False)
session.add(newChatter)
session.commit()
print("New points doled out at: " , time.time())
time.sleep(60)