-
Notifications
You must be signed in to change notification settings - Fork 2
Session
Documentation > Session
Sessions are the keys to the Amatino kingdom. All requests to the Amatino API, except those requests to create Sessions themselves, must include two HTTP headers: An integer session identifier, and a Hashed Message Authentication Code (HMAC) signed with a Session API Key. The Amatino Python Session class handles all authentication requirements for you, inclusion HMAC computation.
Creating a Session with a POST request is analogous to 'logging in', and deleting a Session with a DELETE request is analogous to 'logging out'. Your application might wish to create multiple Sessions for a User. For example, one per device.
The base64-encoded key that authenticates the User of this Session. You should not interact with this value unless you understand the security implications.
Under the hood, this is a 256-bit random number generated in a cryptographically secure manner.
Example: '4LGpi3-kMcyRHY-MW3Qa2HzJ2tIvNJfuOkffq5-uVzE='
A 64-bit integer identifier for this Session.
Example: 4316974952633910666
The 64-bit integer identifier of the User authenticated by this Session.
Example: 8973009721414582153
Returns .session_id
. Provided as convenience for consistency with the many other Amatino Python classes that use id_
as the name for their unique identifier.
Return a new Session created using a User email as the identifying credential
- email - str
- secret - str
session = Session.create_with_email(
email='clever@example.com',
secret='high entropy passphrase'
)
Return a new Session created using a User integer identifier as the identifying credential.
- user_id - int
- secret - str
session = Session.create_with_user_id(
user_id=8973009721414582153,
secret='High entropy passphrase'
)