bain3/pronotepy

PronotePy API Error : pronotepy.exceptions.PronoteAPIError: Your IP address is suspended.

Closed this issue · 7 comments

Hello,

I recently decided to make a WhatsApp bot that gets my class' homework and send it to our group. The problem is that it gives me this error : pronotepy.exceptions.PronoteAPIError: Your IP address is suspended.. I do not know why. My used code is below:

import requests
import pronotepy
from pronotepy.ent import ac_poitiers

# creating the client and passing the occitanie_montpellier function to automatically get cookies from ENT
client = pronotepy.Client('https://HIDING_MY_SCHOOL'S_ID.index-education.net/pronote/eleve.html',
                          username='HIDING_MY_USERNAME',
                          password='HIDING_MY_PASSWORD',
                          ent=ac_poitiers)

if client.logged_in: # check if client successfully logged in
    # get the all the periods (may return multiple types like trimesters and semesters but it doesn't really matter
    # the api will get it anyway)
    nom_utilisateur = client.info.name # get users name
    print(f'Logged in as {nom_utilisateur}')

    today = datetime.date.today() # store today's date using datetime built-in library
    homework = client.homework(today) # get list of homework for today and later
    
    for hw in homework: # iterate through the list
        print(f"({hw.subject.name}): {hw.description}") # print the homework's subject, title and description
    
else: 
    print("Failed to log in")

I would like to get help. Thanks.

P-S : I removed the WhatsApp part, my username, password and school id from this script.

I guess your bot just did too much requests in a certain period of time, so your ip is now suspended by pronote, try to login normally via browser and see if you can login (from the same device where your code is hosted) to see if it works or not, if it doesnt, then you can't do anything about it other that using a vpn or changing the host (it may be ip banned later if you continue doing that much requests)

Yeah, but my bot just comes, get the homework, prints it and dip out, so why would it send that much requests?

How often (i.e. at which frequency) does it run?

Like, twice a week? And I haven't touched it in a month because it's not fully functionnal... The WhatsApp part is functionnal, but because of this, it doesn't.

Okay if its only twice a week it is weird, i can't really help you here, good luck !

Can you try connecting with another IP (i.e. from another wifi network, through a VPN or after rebooting your router if you have a dynamic public IP) to see if the issue persists? Do you still have access to pronote through a web browser?

I kinda don't want to test it because:
Other WiFi network : My computer is on ethernet and doesn't have any WiFi card.
VPN : I don't want to install one just for this
Rebooting router : Don't have dynamic public IP