mirror of
https://github.com/NohamR/PronoteBot.git
synced 2025-05-24 00:49:00 +00:00
fix
This commit is contained in:
parent
97a246b1f4
commit
1d4e05e7af
13
getgrades.py
13
getgrades.py
@ -24,11 +24,14 @@ def envoyer_message_webhook(contenu):
|
||||
data = {
|
||||
'content': contenu
|
||||
}
|
||||
try:
|
||||
response = requests.post(DISCORD_WEBHOOKS_PRONOTE, json=data)
|
||||
if response.status_code == 204:
|
||||
print(f'{datetime.now().strftime("%H:%M")} : Send')
|
||||
else:
|
||||
print(f"Échec de l'envoi du message. Code d'état : {response.status_code}")
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
def refresh(send):
|
||||
content = ''
|
||||
@ -75,6 +78,8 @@ def refresh(send):
|
||||
'subject_name': grade.subject.name,
|
||||
}
|
||||
new_grades_list.append(grade_dict)
|
||||
|
||||
if send == 1:
|
||||
if len(new_grades_list) != len(prev_grades):
|
||||
changes = 0
|
||||
while len(new_grades_list) != len(prev_grades):
|
||||
@ -118,11 +123,14 @@ def refresh(send):
|
||||
status = 0
|
||||
while status != 1:
|
||||
status, content = refresh(send = 0)
|
||||
print('content: ', content)
|
||||
print('status: ', status)
|
||||
if status != 1 :
|
||||
print(status)
|
||||
envoyer_message_webhook(status)
|
||||
time.sleep(2*60)
|
||||
|
||||
|
||||
min = 20
|
||||
print('refresh rate: ', 20)
|
||||
while True:
|
||||
@ -135,8 +143,7 @@ while True:
|
||||
time.sleep(2*60)
|
||||
elif content != '':
|
||||
envoyer_message_webhook(content)
|
||||
|
||||
time.sleep(min*60)
|
||||
|
||||
### debug
|
||||
# refresh(send=1)
|
||||
# ### debug
|
||||
# # refresh(send=1)
|
Loading…
x
Reference in New Issue
Block a user