API Reference#
Functions#
MoabDB API Library
Constants#
MoabDB Constants Manager
- moabdb.constants.login(username: str, key: str)[source]#
Logs in to the API to provide data that is not publically available. Throws an error if the username/key is wrong, or if there’s a connection error.
- Args:
username (str): The email that you signed up with key (str): The key that you got at www.moabdb.com/account/member-api
- Returns:
None: On success, this will return nothing
- Raises:
errors.MoabResponseError: If there’s a problem interpreting the response errors.MoabRequestError: If the server has a problem interpreting the request,
or if an invalid parameter is passed
errors.MoabInternalError: If the server runs into an unrecoverable error internally errors.MoabHttpError: If there’s a problem transporting the payload or receiving a response errors.MoabUnauthorizedError: If the user is not authorized to request the datatype errors.MoabNotFoundError: If the data requested wasn’t found errors.MoabUnknownError: If the error code couldn’t be parsed
Example:
import moabdb as mdb mdb.login("your-signup-email@mail.com", "secret_key") print("Login succeeded")
Errors#
MoabDB Errors
- exception moabdb.errors.MoabError[source]#
Bases:
Exception
Base class for exceptions in this module.
- exception moabdb.errors.MoabHttpError(message)[source]#
Bases:
MoabError
- Exception raised for an error transporting the payload.
This will be thrown if the client cannot reach the server’s HTTP endpoint, or if the endpoint responds outside of HTTP’s RFC.
- Args:
message (str): The message that was returned with the HTTP error
- Attributes:
message (str): The message that was returned with the HTTP error
- exception moabdb.errors.MoabInternalError(message)[source]#
Bases:
MoabError
- Exception raised for an internal error that occured on the server outside of user control.
A user should not be able to reliably throw this.
- Args:
message (str): The message that was returned with the internal error
- Attributes:
message (str): The message that was returned with the internal error
- exception moabdb.errors.MoabNotFoundError(message)[source]#
Bases:
MoabError
Exception raised when the server cannot find the requested data.
- Args:
message (str): The message that was returned with the error
- Attributes:
message (str): The message that was returned with the error
- exception moabdb.errors.MoabRequestError(message)[source]#
Bases:
MoabError
- Exception raised for problems with interpreting the request.
Thrown if bad parameters are passed or if the server recieves a poorly crafted request.
- Args:
message (str): The message that was returned with the request error
- Attributes:
message (str): The message that was returned with the request error
- exception moabdb.errors.MoabResponseError(message)[source]#
Bases:
MoabError
Exception raised for problems interpreting the response
- Args:
message (str): The message that was returned with the response error
- Attributes:
message (str): The message that was returned with the response error
Time Windows#
Time window functions for MoabDB
- moabdb.timewindows.get_unix_dates(sample_len: str, start_dt: str, end_dt: str)[source]#
Convert timestamps/samples into a start and end unix epoch time
- Args:
sample_len (
str
, optional): The sample length to adjust the start/end by start_dt (str
, optional): The start timestamp end_dt (str
, optional): The end timestamp- Returns:
None: On success, this will return nothing
Example:
import moabdb as mdb mdb.login("your-signup-email@mail.com", "secret_key") print("Login succeeded")