onfido-python


Nameonfido-python JSON
Version 2.10.0 PyPI version JSON
download
home_pagehttps://github.com/onfido/onfido-python
SummaryThe official wrapper for the Onfido API
upload_time2023-12-05 10:37:39
maintainer
docs_urlNone
authorBen Ahmady
requires_python>=3.7,<4
licenseMIT
keywords onfido identity
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Onfido Python Client Library

[onfido-python on PyPI](https://pypi.org/project/onfido-python/)

The official wrapper for Onfido's API. Refer to the full [API documentation](https://documentation.onfido.com) for details of expected requests and responses for all resources.

[![PyPI version](https://badge.fury.io/py/onfido-python.svg)](https://badge.fury.io/py/onfido-python)

This version uses Onfido API v3.6. Refer to our [API versioning guide](https://developers.onfido.com/guide/api-versioning-policy#client-libraries) for details of which client library versions use which versions of the API.

This project supersedes the automatically generated [api-python-client](https://github.com/onfido/api-python-client) library (`onfido` in PyPI).

## Installation

`pip install onfido-python`

:warning: Having the old `onfido` package installed at the same time will cause errors.

## Getting started

Make API calls by using an instance of the `Api` class and providing your API
token:

```python
import onfido

api = onfido.Api("<YOUR_API_TOKEN>")
```

### Regions

Set the region in the API instance using the `region` parameter, which takes a value from the `Region` enum (currently `Region.EU`, `Region.US` or `Region.CA`).

For example, to specify the EU region:

```python
import onfido
from onfido.regions import Region

api = onfido.Api("<YOUR_API_TOKEN>", region=Region.EU)
```

`region` does not take a default parameter. Failure to pass a correct region will raise an `OnfidoRegionError`.

See https://documentation.onfido.com/#regions for more information about our supported regions at a given time.

### Timeouts

You 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:

```python
api = onfido.Api("<YOUR_API_TOKEN>", timeout=1)
```

The default value for `timeout` is `None`, meaning no timeout will be set on
the client side.

## Response format

The 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 `.create` to create a resource, `.find` to find one, and `.all` to fetch all resources. 

For example, to create an applicant:

```python
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)
```

```python
{
  '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'
  }
}
```

See https://documentation.onfido.com/#request,-response-format for more
information.

### Resources

Resource information and code examples can be found at https://documentation.onfido.com/.

### Error Handling

- `OnfidoServerError` is raised whenever Onfido returns a `5xx` response
- `OnfidoRequestError` is raised whenever Onfido returns a `4xx` response
- `OnfidoInvalidSignatureError` is raised whenever a signature from the header is not equal to the expected signature you compute for it
- `OnfidoTimeoutError` is raised if a timeout occurs
- `OnfidoConnectionError` is raised whenever any other network error occurs
- `OnfidoUnknownError` is raised whenever something unexpected happens

## Contributing

1. Fork it ( https://github.com/onfido/onfido-python/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Run the tests (`poetry run pytest tests/test_my_new_feature.py`)
4. Commit your changes (`git commit -am 'Add some feature'`)
5. Push to the branch (`git push origin my-new-feature`)
6. Create a new Pull Request

## Support

Should you encounter any technical issues during integration, please contact Onfido’s Customer Support team
via [email](mailto:support@onfido.com), 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](http://public.support.onfido.com).



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/onfido/onfido-python",
    "name": "onfido-python",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7,<4",
    "maintainer_email": "",
    "keywords": "onfido,identity",
    "author": "Ben Ahmady",
    "author_email": "ben.ahmady@onfido.com",
    "download_url": "https://files.pythonhosted.org/packages/5a/5a/273d2d040b6eecfcc6d5d337a0832e30d22c4cb5cc372b4894392d3ea729/onfido_python-2.10.0.tar.gz",
    "platform": null,
    "description": "# Onfido Python Client Library\n\n[onfido-python on PyPI](https://pypi.org/project/onfido-python/)\n\nThe official wrapper for Onfido's API. Refer to the full [API documentation](https://documentation.onfido.com) for details of expected requests and responses for all resources.\n\n[![PyPI version](https://badge.fury.io/py/onfido-python.svg)](https://badge.fury.io/py/onfido-python)\n\nThis version uses Onfido API v3.6. Refer to our [API versioning guide](https://developers.onfido.com/guide/api-versioning-policy#client-libraries) for details of which client library versions use which versions of the API.\n\nThis project supersedes the automatically generated [api-python-client](https://github.com/onfido/api-python-client) library (`onfido` in PyPI).\n\n## Installation\n\n`pip install onfido-python`\n\n:warning: Having the old `onfido` package installed at the same time will cause errors.\n\n## Getting started\n\nMake API calls by using an instance of the `Api` class and providing your API\ntoken:\n\n```python\nimport onfido\n\napi = onfido.Api(\"<YOUR_API_TOKEN>\")\n```\n\n### Regions\n\nSet the region in the API instance using the `region` parameter, which takes a value from the `Region` enum (currently `Region.EU`, `Region.US` or `Region.CA`).\n\nFor example, to specify the EU region:\n\n```python\nimport onfido\nfrom onfido.regions import Region\n\napi = onfido.Api(\"<YOUR_API_TOKEN>\", region=Region.EU)\n```\n\n`region` does not take a default parameter. Failure to pass a correct region will raise an `OnfidoRegionError`.\n\nSee https://documentation.onfido.com/#regions for more information about our supported regions at a given time.\n\n### Timeouts\n\nYou can optionally set a global timeout for all requests in the API\nconstructor. This takes a floating number input and each whole integer\nincrement corresponds to a second. \n\nFor example, to set a timeout of 1 second:\n\n```python\napi = onfido.Api(\"<YOUR_API_TOKEN>\", timeout=1)\n```\n\nThe default value for `timeout` is `None`, meaning no timeout will be set on\nthe client side.\n\n## Response format\n\nThe Python library will return JSON requests directly from the API. Each request corresponds to a resource. \n\nAll resources share the same interface when making API calls. For example, use `.create` to create a resource, `.find` to find one, and `.all` to fetch all resources. \n\nFor example, to create an applicant:\n\n```python\napplicant_details = {\n  'first_name': 'Jane',\n  'last_name': 'Doe',\n  'dob': '1984-01-01',\n  'address': {\n    'street': 'Second Street',\n    'town': 'London',\n    'postcode': 'S2 2DF',\n    'country': 'GBR'\n  },\n  'location': {\n    'ip_address': '127.0.0.1',\n    'country_of_residence': 'GBR'\n  }\n}\n\napi.applicant.create(applicant_details)\n```\n\n```python\n{\n  'id': '<APPLICANT_ID>',\n  'created_at': '2019-10-09T16:52:42Z',\n  'sandbox': True,\n  'first_name': 'Jane',\n  'last_name': 'Doe',\n  'email': None,\n  'dob': '1990-01-01',\n  'delete_at': None,\n  'href': '/v3.1/applicants/<APPLICANT_ID>',\n  'id_numbers': [],\n  'address': {\n    'flat_number': None,\n    'building_number': None,\n    'building_name': None,\n    'street': 'Second Street',\n    'sub_street': None,\n    'town': 'London',\n    'state': None,\n    'postcode': 'S2 2DF',\n    'country': 'GBR',\n    'line1': None,\n    'line2': None,\n    'line3': None\n  },\n  'phone_number': None,\n  'location': {\n    'ip_address': '127.0.0.1',\n    'country_of_residence': 'GBR'\n  }\n}\n```\n\nSee https://documentation.onfido.com/#request,-response-format for more\ninformation.\n\n### Resources\n\nResource information and code examples can be found at https://documentation.onfido.com/.\n\n### Error Handling\n\n- `OnfidoServerError` is raised whenever Onfido returns a `5xx` response\n- `OnfidoRequestError` is raised whenever Onfido returns a `4xx` response\n- `OnfidoInvalidSignatureError` is raised whenever a signature from the header is not equal to the expected signature you compute for it\n- `OnfidoTimeoutError` is raised if a timeout occurs\n- `OnfidoConnectionError` is raised whenever any other network error occurs\n- `OnfidoUnknownError` is raised whenever something unexpected happens\n\n## Contributing\n\n1. Fork it ( https://github.com/onfido/onfido-python/fork )\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Run the tests (`poetry run pytest tests/test_my_new_feature.py`)\n4. Commit your changes (`git commit -am 'Add some feature'`)\n5. Push to the branch (`git push origin my-new-feature`)\n6. Create a new Pull Request\n\n## Support\n\nShould you encounter any technical issues during integration, please contact Onfido\u2019s Customer Support team\nvia [email](mailto:support@onfido.com), including the word ISSUE: at the start of the subject line.\n\nAlternatively, you can search the support documentation available via the customer experience\nportal, [public.support.onfido.com](http://public.support.onfido.com).\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "The official wrapper for the Onfido API",
    "version": "2.10.0",
    "project_urls": {
        "Homepage": "https://github.com/onfido/onfido-python",
        "Onfido API documentation": "https://documentation.onfido.com"
    },
    "split_keywords": [
        "onfido",
        "identity"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "81089f3f02ccadcc74bfa6292e2a29aad3bc86c59769c1a488652c426c74ab91",
                "md5": "bcb6641ced2b6cef5bd367f274b7d06c",
                "sha256": "d06d92464a7cdaaeb4229da8ee859b6e9e047628369fca8d1badfdd724933330"
            },
            "downloads": -1,
            "filename": "onfido_python-2.10.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bcb6641ced2b6cef5bd367f274b7d06c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7,<4",
            "size": 19612,
            "upload_time": "2023-12-05T10:37:38",
            "upload_time_iso_8601": "2023-12-05T10:37:38.073330Z",
            "url": "https://files.pythonhosted.org/packages/81/08/9f3f02ccadcc74bfa6292e2a29aad3bc86c59769c1a488652c426c74ab91/onfido_python-2.10.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5a5a273d2d040b6eecfcc6d5d337a0832e30d22c4cb5cc372b4894392d3ea729",
                "md5": "57d05f5a8c870ed145dfe36819046621",
                "sha256": "a7c24125b9da60556bc038ca9f7e398880a005ffb851fa64da74bbc599950d56"
            },
            "downloads": -1,
            "filename": "onfido_python-2.10.0.tar.gz",
            "has_sig": false,
            "md5_digest": "57d05f5a8c870ed145dfe36819046621",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7,<4",
            "size": 11056,
            "upload_time": "2023-12-05T10:37:39",
            "upload_time_iso_8601": "2023-12-05T10:37:39.988310Z",
            "url": "https://files.pythonhosted.org/packages/5a/5a/273d2d040b6eecfcc6d5d337a0832e30d22c4cb5cc372b4894392d3ea729/onfido_python-2.10.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-05 10:37:39",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "onfido",
    "github_project": "onfido-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "onfido-python"
}
        
Elapsed time: 0.18489s