Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Unknown error from pronote: 3 | Accès refusé #271

Open
zerocomte opened this issue Sep 27, 2023 · 2 comments
Open

Error Unknown error from pronote: 3 | Accès refusé #271

zerocomte opened this issue Sep 27, 2023 · 2 comments

Comments

@zerocomte
Copy link

Hello,

I tried the example and i got this error:

raise PronoteAPIError(pronotepy.exceptions.PronoteAPIError: Unknown error from pronote: 3 | Accès refusé

The logging is ok, it can find my first name and my last name.

How i can resolv it or get more information about the problem?

Kind regards,
Thomas

@ShadowMikado
Copy link
Contributor

Hey, could you send the code that is causing this error?

@zerocomte
Copy link
Author

zerocomte commented Oct 1, 2023

Yes:

import pronotepy
import datetime
# initialise the client
# Note: the address should be a direct one (like the one below) usually the address shown by your school just redirects
# you to the real one.
# Ex.: https://your-school.com/pronote/students <-- BAD
#      https://0000000a.index-education.net/pronote/eleve.html <-- GOOD
#      https://0000000a.index-education.net/pronote/eleve.html?login=true <-- ONLY IF YOU HAVE AN ENT AND YOU KNOW YOUR IDS, ELSE REFER TO ENT PART OF README
client = pronotepy.Client('https://0870016v.index-education.net/pronote/eleve.html',
                          username='<username>',
                          password='<password>')

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}')
    
    periods = client.periods

    for period in periods:
        for grade in period.grades:  # iterate over all the grades
            print(f'{grade.grade}/{grade.out_of}')  # print out the grade in this style: 20/20

    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")
    exit()
    

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants