API for EET
Project description
Python EET API
Simple to use and mostly secure (mainly pedantic) API for Czech EET Gate.
Installation
pip install czech-eet
Usage
Basic usage with single request
from eet import invoices, helpers
cert_text = b'''
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----
'''
key_text = b'''
-----BEGIN RSA PRIVATE KEY-----
...
-----END RSA PRIVATE KEY-----
'''
# prepare certificate and private key
cert = helpers.parse_cert(cert_text)
pk = helpers.parse_key(key_text)
# create config
config = invoices.Config(cert, pk, 141, "1patro-vpravo")
# create factory using config
factory = invoices.Factory(config)
# build new invoice & send
invoice = factory.new("141-18543-05", 236.00, zakl_dan1=100.0, dan1=21.0)
response = invoice.send()
# note: if resending, you should set `eet.invoice.Hlavicka["prvni_zaslani"] = eet.types.boolean(False)`
# or use scheduler ;-)
# now validate response and get fik
codes = response.codes()
if response:
print("BKP: {0}\nFIK: {1}".format(codes.bkp, codes.fik))
else:
print("BKP: {0}\nPKP: {1}".format(codes.bkp, codes.pkp))
print("Errors:", response.Chyba, response.Varovani)
Example of scheduler
from eet import invoices, helpers, remote
... # prepare invoice as before
# create instance of scheduler
scheduler = remote.Scheduler()
# same as before but now you can resend invoices
response = scheduler.process(invoice)
# call dispatch is reasonable time interval from your mainloop
import time
while True:
scheduler.dispatch()
time.sleep(60)
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
czech-eet-1.0.5.tar.gz
(8.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
czech_eet-1.0.5-py3-none-any.whl
(11.1 kB
view details)
File details
Details for the file czech-eet-1.0.5.tar.gz.
File metadata
- Download URL: czech-eet-1.0.5.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da1d3e00541f7904e0bf80743df74dd0d166d2acc5325ddd426915c01293d89e
|
|
| MD5 |
ab1d589231ce4f99c6879d535b9de19e
|
|
| BLAKE2b-256 |
beb9096e6f34803df2308bc6a4cd108da4b78b38c2b10dba6ace9f26e2685902
|
File details
Details for the file czech_eet-1.0.5-py3-none-any.whl.
File metadata
- Download URL: czech_eet-1.0.5-py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f68fedd5d0e275a9433b36c50432f50d9762b8476c171f44743efc1c2794b3df
|
|
| MD5 |
8ff75c953e22982da0090b20174d2348
|
|
| BLAKE2b-256 |
880aa8e13e292d187efc5c2adccab5419465deac02ec5abe176ffba9159138d6
|