maxmods
maxmods is a collection of tools for user authentication and data management. The library is released under the MIT License and the documentation is generated by an AI trained by OpenAI.
maxmods.auth
The maxmods.auth
module provides a simple way to handle user authentication and data storage on a remote server. The AuthSesh
class allows users to sign up, log in, and manage their data on the server.
Usage
To use the AuthSesh
class, you first need to create an instance of the class and set the username and password:
from maxmods.auth import AuthSesh
auth = AuthSesh()
auth.set_vals("username", "password")
Once the username and password are set, you can use the login()
method to log in to the server:
If the login is successful, you can use the save()
and load()
methods to save and load data from the server. For example:
auth.save("user_data/profile", {"name": "John Doe", "email": "johndoe@example.com"})
user_data = auth.load("user_data/profile")
When you are done with the instance, you have to use the terminate()
method to end the connention with the server:
Note: If you do not do this, nothing you do on the server will save.
The AuthSesh
class also provides methods for signing up new users, removing users, and terminating the session. For more details and examples, see the AuthSesh class documentation.
Context Manager
The AuthSesh
class can be used as a context manager to automatically log out and terminate the session when the context ends:
from maxmods.auth import AuthSesh
with AuthSesh() as auth:
auth.set_vals("username", "password")
auth.login()
# ...
Exceptions
The AuthSesh
class raises the following exceptions:
AuthenticationError
: Raised if there is an error authenticating the user.DataError
: Raised if there is an error accessing or modifying the data on the server.LocationError
: Raised if the specified location does not exist on the server.PasswordError
: Raised if the password is incorrect or invalid.UsernameError
: Raised if the username is invalid or already in use.
Installation
$ pip install maxmods
License and Disclaimer
The maxmods library is licensed under the MIT License, which means it is free to use and distribute for both personal and commercial purposes. The documentation for the library has been generated by an AI trained by OpenAI, and may not be entirely accurate or up-to-date. It is recommended to consult the source code for the library for the most accurate information.
Authors