API Wrapper and Django app for Exact Online
- transparently handles re-authentication. Exact's OAuth2 tokens are valid for 10 minutes
- handles pagination.
filter()returns a generator - uses connection keep-alive (thanks to the requests library) resulting in huge performance gain. Exact can take over 5 seconds to establish a HTTPS/TLS connection, subsequent requests are faster)
Setup
install && migrate
settings.py:
EXACT_ONLINE_API_URL = "https://start.exactonline.nl/api"
EXACT_ONLINE_CLIENT_ID = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
EXACT_ONLINE_CLIENT_SECRET = "asdf"
EXACT_ONLINE_REDIRECT_URI = "http://localhost:8000/exact/authenticate"
EXACT_ONLINE_DIVISION = 1234567
urls.py:
url(r'^exact/', include(('exact.urls', 'exact'), namespace='exact'))
Usage
go to http://localhost:8000/exact/authenticate to start the OAuth2 dance.
generic usage: first param is the resource. see Exact Online for available resources
from exact.api import Exact
e = Exact()
# first param is the resource.
# see https://start.exactonline.nl/docs/HlpRestAPIResources.aspx
# filter returns a generator and handles pagination for you
for acc in e.filter("crm/Accounts", filter_string="substringof('GmbH', Name) eq true"):
pass
# can raise e.DoesNotExist and e.MultipleObjectsReturned
e.get(resource, filter_string=None, select=None):
e.create(resource, data)
e.update(resource, guid, data)
e.delete(resource, guid)
see odata.org for info on how to use filter_string
errors (all subclasses of ExactException, which carries the response and error_message):
from exact.api import ExactAuthException, ExactException, ExactUnavailable
try:
e.create(resource, data)
except ExactUnavailable:
pass # 5xx or maintenance page, try again later
except ExactAuthException as ex:
print(ex.error_message) # getting/refreshing the token failed, e.g. "Refresh token is invalid."
except ExactException as ex:
print(ex.error_message) # e.g. a validation error
helpers:
from exact.api import Exact
e = Exact()
e.accounts.get(code="1234")
e.glaccounts.get(code="1234")
e.costcenters.get(code="12345")
webhooks
... are easily created/deleted through /admin/exact/webhook
Metadata
Release files for django-exact 0.10.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django_exact-0.10.0.tar.gz | 12.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_exact-0.10.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.5 kB
Release files / django_exact-0.10.0.tar.gz
| Download URL | django_exact-0.10.0.tar.gz |
|---|---|
| Size | 12.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
532adb8cd4194bc5a5c4ab319cc8ba6190caa591f20d42cdde47dc0f11f44e26
|
|
BLAKE2b-256 checksum How to use checksums |
f548d0f7653b6f7a1b88e04d501dff11643e5f4980a02e9ba37d8a2a6fa23bcb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / django_exact-0.10.0-py3-none-any.whl
| Download URL | django_exact-0.10.0-py3-none-any.whl |
|---|---|
| Size | 13.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1ea91c4ce989a6a5134c0ddfa17f02f51f2a5a07ef6f55790aca28cf86c24026
|
|
BLAKE2b-256 checksum How to use checksums |
91d83c5624326689d297eb60946847134f236e48f918bb96df1566efe4763ca1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|