Package: passbyme2fa_client
PassBy[ME] Mobile ID clientThis library provides you with functionality to handle PassBy[ME]
messages.For further information on PassBy[ME] please visit:www.passbyme.comand sign up for a free
account. You can download our API documentation after login.Table of contentsInstallationUsagePassByME2FAClientHandling messagesSending messagesTracking messagesCancelling messagesSessionInfoErrorsHTTPErrorPassByMEErrorBuildRelease HistoryInstallationMinimum required Python version is 2.7.9.pip install passbyme2fa_clientUsageTo use the PassBy[ME] Mobile ID SDK first you have to acquire the
following:Account authentication PEM file and its passwordYou can get these after registering atwww.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.PassByME2FAClientfrompassbyme2fa_clientimport*pbm=PassByME2FAClient(key="auth.pem",cert="auth.pem",password="<auth.pem password>")ThePassByME2FAClientconstructor accepts the following parameters:key: the path of the authentication key PEM file.cert: the path of the authentication certificate PEM file. (May
be the same askeyif the PEM file contains both the certificate
and the key.)address: The address of the PassBy[ME] service to use. This
parameter is optional. by default the SDK will connect to
auth-sp.passbyme.com.Throws aValueErrorwhen a required parameter is missing.Handling MessagesSending messagessession_info=pbm.send_message(recipients=["test@pers.on"],availability=300,type=PassByME2FAClient.MessageType.AUTHORIZATION,subject="Test subject",body="Test message")Thesend_messagemethod accepts the following parameters:recipients: An array containing the PassBy[ME] ID-s of the
recipientssubject: The subject of the messagebody: The body of the messageavailability: The availability of the message in secondstype: One of the following types:PassByME2FAClient.MessageType.AUTHORIZATION- for
authorization requestsPassByME2FAClient.MessageType.MESSAGE- to send a general
message with arbitrary bodyPassByME2FAClient.MessageType.ESIGN- if the message body
contains an esign urlWhen successful, returns aSessionInfoobject.Throws aValueErrorwhen a required parameter is missing. Throws anHTTPErrorif an error in HTTP communication occurs.HTTPError.responsecontains the HTTP response. Throws aPassByMEErrorif a PassBy[ME] specific error
occurs.PassByMEError.responsecontains the JSON response received
from the PassBy[ME] server as a dictionary.Tracking messagessession_info.refresh()To track messages, the most efficient way is to callSessionInfo.refresh(). After a successful call, theSessionInfoobject will contain up-to-date
information about the message.Throws anHTTPErrorif an error in HTTP communication
occurs. Throws aPassByMEErrorif a PassBy[ME]
specific error occurs.Cancelling messagessession_info.cancel()To cancel the message, the most efficient way is to callSessionInfo.cancel(). After a successful call, the message will be
cancelled and theSessionInfoobject will contain
up-to-date information about the message.Throws anHTTPErrorif an error in HTTP communication
occurs. Throws aPassByMEErrorif a PassBy[ME]
specific error occurs.SessionInfoTheSessionInfoobject describes the state of a message session. It
consists of the following attributes:message_id: The id of the message that can be used to reference
the messageexpiration_date: The date and time (as anArrowobject)
until which the message can be downloaded with the PassBy[ME]
applicationsrecipient_statuses: An array ofRecipientStatusobjects.
Each object consist of the following fields:user_id: The PassBy[ME] ID of the user represented by this
recipient objectstatus: The delivery status of this message for this userAvailable statuses are (all constants available asPassByME2FAClient.MessageStatus.*):PENDING: Initial status of the message.NOTIFIED: The recipient has been notified about a new message.DOWNLOADED: The recipient has downloaded the message, but has not
uploaded the evidence yet.SEEN: The recipient has seen the message and uploaded the
evidence.NOT_SEEN: The recipient has not seen the message.NOT_NOTIFIED: The recipient has not received the notification.NOT_DOWNLOADED: The recipient received the notification about
the message but has not downloaded the messageNO_DEVICE: The message could not be sent because the recipient
had no PassBy[ME] ready device that supports messaging.FAILED: The message could not be sent because of an error.DISABLED: The message could not be sent because the recipient is
disabled.CANCELLED: The message was cancelled by the sender.APPROVED: Authentication has finished successfully.DENIED: The user has cancelled the authentication.ErrorsHTTPErrorDenotes that the server responded with a HTTP error code. Its readableresponseattribute contains theHTTPResponsereceived from the server.PassByMEErrorDenotes a PassBy[ME] specific error. See the API documentation for the
possible error codes. Its readableresponseattribute contains the
JSON message received from the server as a dictionary.BuildTo build the package, first we have to run our tests, which can be done
typingpython setup.py testIf the tests all pass, we can create the distribution package using the
commandpython setup.py sdist