Package: onfido-python
Onfido Python Client Libraryonfido-python on PyPIThe official wrapper for Onfido's API. Refer to the fullAPI documentationfor details of expected requests and responses for all resources.This version uses Onfido API v3.6. Refer to ourAPI versioning guidefor details of which client library versions use which versions of the API.This project supersedes the automatically generatedapi-python-clientlibrary (onfidoin PyPI).Installationpip install onfido-python:warning: Having the oldonfidopackage installed at the same time will cause errors.Getting startedMake API calls by using an instance of theApiclass and providing your API
token:importonfidoapi=onfido.Api("<YOUR_API_TOKEN>")RegionsSet the region in the API instance using theregionparameter, which takes a value from theRegionenum (currentlyRegion.EU,Region.USorRegion.CA).For example, to specify the EU region:importonfidofromonfido.regionsimportRegionapi=onfido.Api("<YOUR_API_TOKEN>",region=Region.EU)regiondoes not take a default parameter. Failure to pass a correct region will raise anOnfidoRegionError.Seehttps://documentation.onfido.com/#regionsfor more information about our supported regions at a given time.TimeoutsYou can optionally set a global timeout for all requests in the API
constructor. This takes a floating number input and each whole integer
increment corresponds to a second.For example, to set a timeout of 1 second:api=onfido.Api("<YOUR_API_TOKEN>",timeout=1)The default value fortimeoutisNone, meaning no timeout will be set on
the client side.Response formatThe Python library will return JSON requests directly from the API. Each request corresponds to a resource.All resources share the same interface when making API calls. For example, use.createto create a resource,.findto find one, and.allto fetch all resources.For example, to create an applicant:applicant_details={'first_name':'Jane','last_name':'Doe','dob':'1984-01-01','address':{'street':'Second Street','town':'London','postcode':'S2 2DF','country':'GBR'},'location':{'ip_address':'127.0.0.1','country_of_residence':'GBR'}}api.applicant.create(applicant_details){'id':'<APPLICANT_ID>','created_at':'2019-10-09T16:52:42Z','sandbox':True,'first_name':'Jane','last_name':'Doe','email':None,'dob':'1990-01-01','delete_at':None,'href':'/v3.1/applicants/<APPLICANT_ID>','id_numbers':[],'address':{'flat_number':None,'building_number':None,'building_name':None,'street':'Second Street','sub_street':None,'town':'London','state':None,'postcode':'S2 2DF','country':'GBR','line1':None,'line2':None,'line3':None},'phone_number':None,'location':{'ip_address':'127.0.0.1','country_of_residence':'GBR'}}Seehttps://documentation.onfido.com/#request,-response-formatfor more
information.ResourcesResource information and code examples can be found athttps://documentation.onfido.com/.Error HandlingOnfidoServerErroris raised whenever Onfido returns a5xxresponseOnfidoRequestErroris raised whenever Onfido returns a4xxresponseOnfidoInvalidSignatureErroris raised whenever a signature from the header is not equal to the expected signature you compute for itOnfidoTimeoutErroris raised if a timeout occursOnfidoConnectionErroris raised whenever any other network error occursOnfidoUnknownErroris raised whenever something unexpected happensContributingFork it (https://github.com/onfido/onfido-python/fork)Create your feature branch (git checkout -b my-new-feature)Run the tests (poetry run pytest tests/test_my_new_feature.py)Commit your changes (git commit -am 'Add some feature')Push to the branch (git push origin my-new-feature)Create a new Pull RequestSupportShould you encounter any technical issues during integration, please contact Onfido’s Customer Support team
viaemail, including the word ISSUE: at the start of the subject line.Alternatively, you can search the support documentation available via the customer experience
portal,public.support.onfido.com.