REST
The REST package implements all the necessary modules to set up an API REST. The API REST have been developed with the Flask framework and uses the SQLAlchemy ORM for the database operations, the Flask login package for login operations and the Flask WTF package for the forms.
This package uses the database configured by the CORE package. It implements the necessary functions to add, modify and delete password. For now, it will only access to the local database and the users stored there.
app
models
forms
This module implements all the necessary forms for the app. These forms are called at the start of the functions from
the REST.app() module.
- class REST.forms.AddPassForm(*args, **kwargs)[source]
This class represents the form the user will see during adding a password. It sets up three entries: the site name , the username and the password. It also implements a button to submit the fields.
The site name, master password and username entries are required.
- class REST.forms.DeletePassForm(*args, **kwargs)[source]
This class represents the form the user will see during deleting a password. It sets up one entry for the id of the password and a button to submit the data.
The id entry is required.
- class REST.forms.LoginForm(*args, **kwargs)[source]
This class represents the form the user will see during login. It sets up two entries: the one for the username, for the master password and a button to submit the data.
The username and the master password are required which means that the user must enter data on that entries.
- class REST.forms.ModifyPassForm(*args, **kwargs)[source]
This class represents the form the user will see during modifying a password. It sets up five entries: the id, the new site name, the new username, the new password, a second entry to enter the new password and the button to submit the data
None entries are required.
- class REST.forms.RegisterForm(*args, **kwargs)[source]
This class represents the form the user will see during a registration. It sets up four entries: the username, the master password, an entry to enter the master password once again and the email entry. It also implements a button to submit the fields.
The username, master password and second password entries are required.
config
This module is used to set up some configurations to the flask app.
login
This module is used to log in and log out a user from a session from flask. The LoginManager object needs this
data to work properly.
- REST.login.login_user(user)[source]
This function adds the information of the user logged to the
sessionobject.- Parameters
user – Is the user that is trying to log in
- REST.login.logout_user()[source]
This function drops all the information about the user logged so the next time will ask again for a login.
When the time set in the
REST.config()for the user to be active is exceeded this function is called.