<p align="center"><img alt="logo" src="https://www.zypp.io/static/assets/img/logos/zypp/white/500px.png" width="200"></p>
[](https://pepy.tech/project/twinfield)
[](https://opensource.org/)
[](https://github.com/psf/black)
[](https://pypi.org/project/twinfield/)
[](https://github.com/zypp-io/twinfield/releases)
Twinfield
====
---
> Python package for reading Twinfield data using the Twinfield API.
## Installation
---
```commandline
pip install twinfield
```
## Usage
for an extensive list of examples, please checkout the [twinfield test suite](twinfield/tests/test_twinfield.py).
```python
from twinfield import TwinfieldApi
# logging in
tw = TwinfieldApi()
# sending browse request.
df = tw.query_by_year(code="030_3", year=2021)
# sending dimensions request
df = tw.dimensions(dim_type="CRD")
```
## required environment variables
Twinfield works with OpenID Connect. OpenID Connect is a simple identity layer on top of the OAuth 2.0 protocol.
In order to authenticate with the twinfield server, the following environment variables must be set. Please see the
[Twinfield webservice documentation](https://accounting.twinfield.com/webservices/documentation/#/ApiReference/Authentication/OpenIdConnect)
on the walktrough how to obtain the refresh token and set the app registration.
```shell
"TWINFIELD_ORGANISATION"
"TWINFIELD_CLIENT_ID"
"TWINFIELD_CLIENT_SECRET"
"TWINFIELD_REFRESH_TOKEN"
```
## optional environment variables
TQDM accepts environmental variables to overwrite default settings `TQDM_*` i.e.,
```shell
TQDM_DISABLE=1
TQDM_MININTERVAL=5
```
How to set environment variables?
- [Windows](https://stackoverflow.com/questions/5898131/set-a-persistent-environment-variable-from-cmd-exe)
- [macOS](https://apple.stackexchange.com/questions/106778/how-do-i-set-environment-variables-on-os-x)
- [Linux](https://unix.stackexchange.com/questions/117467/how-to-permanently-set-environmental-variables)
---
## api scoping (security) advice
Please note that there are different levels of API access in Twinfield app's. It is recommended to use level 3 access over level 1 access.
Level 3 is sufficient for working with the dataservices.
### Twinfield deprecation notices
- The module salesinvoice is only to be used if invoices need to be generated. If only the transaction registration is necessary, use the transactions endpoint.
- modules have versions, for instance the 030 module can be pulled with suffix _1 or _3. It is advised to use the latest version because the speed of the requests is greater.
---
[Link](https://www.twinfield.nl/api) to the Twinfield API documentation.
---
For business inquiries concerning this package, contact us at hello@zypp.io
Raw data
{
"_id": null,
"home_page": "https://github.com/zypp-io/twinfield",
"name": "twinfield",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "python, twinfield, API",
"author": "Zypp",
"author_email": "hello@zypp.io",
"download_url": "https://files.pythonhosted.org/packages/a0/07/66059b63d59e46e393f85deeb9196e2f7de51fc43304d2d2bba8a7030cb8/twinfield-2.1.3.tar.gz",
"platform": null,
"description": "<p align=\"center\"><img alt=\"logo\" src=\"https://www.zypp.io/static/assets/img/logos/zypp/white/500px.png\" width=\"200\"></p>\n\n[](https://pepy.tech/project/twinfield)\n[](https://opensource.org/)\n[](https://github.com/psf/black)\n[](https://pypi.org/project/twinfield/)\n[](https://github.com/zypp-io/twinfield/releases)\n\nTwinfield\n====\n\n---\n> Python package for reading Twinfield data using the Twinfield API.\n\n## Installation\n\n---\n```commandline\npip install twinfield\n```\n\n## Usage\nfor an extensive list of examples, please checkout the [twinfield test suite](twinfield/tests/test_twinfield.py).\n\n```python\nfrom twinfield import TwinfieldApi\n\n# logging in\ntw = TwinfieldApi()\n\n# sending browse request.\ndf = tw.query_by_year(code=\"030_3\", year=2021)\n\n# sending dimensions request\ndf = tw.dimensions(dim_type=\"CRD\")\n```\n## required environment variables\nTwinfield works with OpenID Connect. OpenID Connect is a simple identity layer on top of the OAuth 2.0 protocol.\nIn order to authenticate with the twinfield server, the following environment variables must be set. Please see the\n[Twinfield webservice documentation](https://accounting.twinfield.com/webservices/documentation/#/ApiReference/Authentication/OpenIdConnect)\non the walktrough how to obtain the refresh token and set the app registration.\n\n```shell\n\"TWINFIELD_ORGANISATION\"\n\"TWINFIELD_CLIENT_ID\"\n\"TWINFIELD_CLIENT_SECRET\"\n\"TWINFIELD_REFRESH_TOKEN\"\n```\n\n## optional environment variables\nTQDM accepts environmental variables to overwrite default settings `TQDM_*` i.e.,\n```shell\nTQDM_DISABLE=1\nTQDM_MININTERVAL=5\n```\n\nHow to set environment variables?\n- [Windows](https://stackoverflow.com/questions/5898131/set-a-persistent-environment-variable-from-cmd-exe)\n- [macOS](https://apple.stackexchange.com/questions/106778/how-do-i-set-environment-variables-on-os-x)\n- [Linux](https://unix.stackexchange.com/questions/117467/how-to-permanently-set-environmental-variables)\n\n---\n\n## api scoping (security) advice\nPlease note that there are different levels of API access in Twinfield app's. It is recommended to use level 3 access over level 1 access.\nLevel 3 is sufficient for working with the dataservices.\n\n### Twinfield deprecation notices\n- The module salesinvoice is only to be used if invoices need to be generated. If only the transaction registration is necessary, use the transactions endpoint.\n- modules have versions, for instance the 030 module can be pulled with suffix _1 or _3. It is advised to use the latest version because the speed of the requests is greater.\n\n\n---\n\n[Link](https://www.twinfield.nl/api) to the Twinfield API documentation.\n\n---\n\nFor business inquiries concerning this package, contact us at hello@zypp.io\n",
"bugtrack_url": null,
"license": null,
"summary": "Read and insert data using the Twinfield API.",
"version": "2.1.3",
"project_urls": {
"Bug Reports": "https://github.com/zypp-io/twinfield/issues",
"Homepage": "https://github.com/zypp-io/twinfield",
"Source": "https://github.com/zypp-io/twinfield"
},
"split_keywords": [
"python",
" twinfield",
" api"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "c70752a1e680b7037fd0f40a1993f8155f47581e30a8763989252fdd271ce452",
"md5": "77c670e42cebfbf94bcdbec18c5377d2",
"sha256": "be90bb2838d4513c5137f4a4efb8f6883310c0d06c451e6e65866fbcf83d9574"
},
"downloads": -1,
"filename": "twinfield-2.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "77c670e42cebfbf94bcdbec18c5377d2",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 21561,
"upload_time": "2025-08-24T16:48:02",
"upload_time_iso_8601": "2025-08-24T16:48:02.257015Z",
"url": "https://files.pythonhosted.org/packages/c7/07/52a1e680b7037fd0f40a1993f8155f47581e30a8763989252fdd271ce452/twinfield-2.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "a00766059b63d59e46e393f85deeb9196e2f7de51fc43304d2d2bba8a7030cb8",
"md5": "4fc730dbe2a6819641037183e85759bd",
"sha256": "f25b2022ca2d265ec38c2c43061fde8e6cb751254790e296793d7f0e9174969a"
},
"downloads": -1,
"filename": "twinfield-2.1.3.tar.gz",
"has_sig": false,
"md5_digest": "4fc730dbe2a6819641037183e85759bd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 18242,
"upload_time": "2025-08-24T16:48:03",
"upload_time_iso_8601": "2025-08-24T16:48:03.708505Z",
"url": "https://files.pythonhosted.org/packages/a0/07/66059b63d59e46e393f85deeb9196e2f7de51fc43304d2d2bba8a7030cb8/twinfield-2.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-24 16:48:03",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "zypp-io",
"github_project": "twinfield",
"github_not_found": true,
"lcname": "twinfield"
}