Skip to main content

Read and insert data using the Twinfield API.

Project description

logo

Downloads Open Source Code style: black PyPI Latest release

Twinfield


Python package for reading Twinfield data using the Twinfield API.

Installation


pip install twinfield

Usage

for an extensive list of examples, please checkout the twinfield test suite.

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 on the walktrough how to obtain the refresh token and set the app registration.

"TWINFIELD_ORGANISATION"
"TWINFIELD_CLIENT_ID"
"TWINFIELD_CLIENT_SECRET"
"TWINFIELD_REFRESH_TOKEN"

How to set environment 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 to the Twinfield API documentation.


For business inquiries concerning this package, contact us at:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

twinfield-2.1.2.tar.gz (17.9 kB view hashes)

Uploaded Source

Built Distribution

twinfield-2.1.2-py3-none-any.whl (21.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page