Setup and Login
Initial Code
To first use the code, you need to import it.
from igrade import Client # the code may look slightly different if you have it set up differently.
Then, you have to initialize the client.
client = Client()
Note
We are not going to include simple snippets of code such as imports and client initialization in the rest of the documentation. Keep this in mind while reading this guide!
There are also a few options you can choose while initializing the
client object. Then only one now is debug, which you can use by typing
client = Client(debug=True). This will prints error messages and
status to the console. It will be useful if you ever encounter errors.
Login
There are two ways that you can use to log in to your account. The first way is to use your credentials, and the wrapper will automatically log in to your account for you. The second way is by using your session cookies. We personally recommend using your login credentials because it is easier, but if you do want to save that .3 seconds that it takes to log in, you may use your session ID tokens.
Login in with Credentials
To log in with your iGrade credentials, use this code:
from igrade import Client
username = 'user123'
password = 'admin1234!'
client = Client()
client.login_with_credentials(username, password)
client.close() # this needs to be included, see below
Tip
You have to close the client in order to properly shut down the program. Failing to do so will cause a lot of warnings to show up in the console. See here for more info.
It’s that easy! Once you have this code, you can now use all other functions and methods included within the Client object. If you ever input the wrong credentials, it will through an error so you don’t have to encounter errors later in the program. And no, you cannot brute force credentials using this method ;)
Warning
If you do not log in before using the module, an error will be thrown.