Messaging SDK for PassBy[ME] Mobile ID solution
This library provides you with functionality to handle PassBy[ME] messages.
For further information on PassBy[ME] please visit: www.passbyme.com and sign up for a free account. You can download our API documentation after login.
pip install passbyme2fa_client
To use the PassBy[ME] Mobile ID SDK first you have to acquire the following:
You can get these after registering at www.passbyme.com, by hitting the “Sign up for free” button. To complete the registration you will need an Android, iOS or Windows Phone device with the PassBy[ME] application installed.
If you login after registration you can download the PEM from the Application menu. You can add new applications to your registration by hitting the “New application”. The application (along with its Application Id) will appear in the table below.
We suggest you to read the available User Guides and API documentation before you continue with the integration. You can download these from the Documentation section of the administration website after login.
from passbyme2fa_client import * pbm = PassByME2FAClient( key = "auth.pem", cert = "auth.pem", password = "<auth.pem password>" )
The PassByME2FAClient constructor accepts the following parameters:
Throws a ValueError when a required parameter is missing.
session_info = pbm.send_message( recipients = ["email@example.com"], availability = 300, type = PassByME2FAClient.MessageType.AUTHORIZATION, subject = "Test subject", body = "Test message" )
The send_message method accepts the following parameters:
When successful, returns a SessionInfo object.
Throws a ValueError when a required parameter is missing. Throws an HTTPError if an error in HTTP communication occurs. HTTPError.response contains the HTTP response. Throws a PassByMEError if a PassBy[ME] specific error occurs. PassByMEError.response contains the JSON response received from the PassBy[ME] server as a dictionary.
To track messages, the most efficient way is to call SessionInfo.refresh(). After a successful call, the SessionInfo object will contain up-to-date information about the message.
To cancel the message, the most efficient way is to call SessionInfo.cancel(). After a successful call, the message will be cancelled and the SessionInfo object will contain up-to-date information about the message.
The SessionInfo object describes the state of a message session. It consists of the following attributes:
Available statuses are (all constants available as PassByME2FAClient.MessageStatus.*):
Denotes that the server responded with a HTTP error code. Its readable response attribute contains the HTTPResponse received from the server.
Denotes a PassBy[ME] specific error. See the API documentation for the possible error codes. Its readable response attribute contains the JSON message received from the server as a dictionary.
To build the package, first we have to run our tests, which can be done typing
python setup.py test
If the tests all pass, we can create the distribution package using the command
python setup.py sdist