API REFERENCE¶
Api description
-
class
messente.verigator.api.
Api
(username, password, endpoint='https://api.verigator.com')¶ Main class for verigator api, contains references to other controllers
- Attributes:
services (controllers.Services): controller for service resource
users (controllers.Users): controller for user resource
auth (controllers.Auth): controller for auth resource
-
__init__
(username, password, endpoint='https://api.verigator.com')¶ Initialize Verigator api
- Args:
username (str): api username. Can be obtained from dashboard
password (str): api password. Can be obtained from dashboard
endpoint (str): api endpoint. Can be obtained from dashboard
-
__weakref__
¶ list of weak references to the object (if defined)
Controllers module of the api
-
class
messente.verigator.controllers.
Services
(rest_client)¶ Controller for service resource
-
create
(*args)¶ Creates new service.
- Args:
domain (str): The domain name.
name (str): The name of the service.
- Returns:
- models.Service: created service
-
delete
(*args)¶ Deletes service with id
- Args:
- id (str): service id
- Returns:
- bool:
-
get
(*args)¶ Fetches service with a given id from the server.
- Args:
- id (str): The id of the service
- Returns:
- models.Service: Fetched service
-
-
class
messente.verigator.controllers.
Users
(rest_client)¶ Controller for service resource
-
create
(*args)¶ Creates new user for the given service
- Args:
service_id (str): service id
number (str): users phone number, used for 2fa
username (str): username
- Returns:
- models.User: created user
-
delete
(*args)¶ Deleted user with given id for the given service
- Args:
service_id (str): service id
id (str): user id
- Returns:
- bool: True on success raises exception on error
-
get
(*args)¶ Fetches single user with given id for the given service
- Args:
service_id (str): service id
id (str): user id
- Returns:
- models.User: fetched user
-
get_all
(*args)¶ Fetches all users for the given service
- Args:
- service_id (str): service id to search users for
- Returns:
- list[models.User]: list of users
-
-
class
messente.verigator.controllers.
Auth
(rest_client)¶ Controller for service resource
-
initiate
(*args)¶ Initiates authentication process sends sms in case of sms authentication
- Args:
service_id (str): service id
user_id (str): user id
method (str): auth method (sms or totp) use Auth.METHOD_SMS or Auth.METHOD_TOTP
- Note:
- System will automatically fall back from TOTP to SMS if user has no devices attached to the number
-
verify
(*args)¶ Verifies user input validity
- Args:
service_id (str): service id
user_id (str): user id
token (str): user provided token
- Returns:
- (bool, dict): boolean indicating verification status and error dict in case verification fails
-
-
class
messente.verigator.models.
Service
(id, creation_time, name)¶ - Attributes:
id (str): unique id
creation_time (str): creation time
name (str): name of the service
-
class
messente.verigator.models.
User
(id, creation_time, username)¶ - Attributes:
id (str): unique id
creation_time (str): creation time
username (str): name of the user
Exceptions module of the api
-
class
messente.verigator.exceptions.
VerigatorError
(code, message)¶ Base error class for all verigator related errors.
-
class
messente.verigator.exceptions.
InvalidDataError
(code, message)¶ This error is raised when provided data is invalid
-
class
messente.verigator.exceptions.
NoSuchResourceError
(code, message)¶ This error is raised when the resource that yu were looking for does not exist
-
class
messente.verigator.exceptions.
ResourceAlreadyExistsError
(code, message)¶ This error is raised when you are creating resource that already exists
-
class
messente.verigator.exceptions.
ResourceForbiddenError
(code, message)¶ This error raises when you don’t have permissions to access the resource
-
class
messente.verigator.exceptions.
WrongCredentialsError
(code, message)¶ This error raises when you provided invalid credentials. Please see messente dashboard for correct username and password
-
class
messente.verigator.exceptions.
InternalError
(code, message)¶ This error means that there is a problem on the server side.
-
class
messente.verigator.exceptions.
InvalidResponseError
(code, message)¶ This error usually raises when server returned non-json response