API for EET
Project description
Python EET API
Simple to use and mostly secure (mainly pedantic) API for Czech EET Gate.
Instalation
pip install ...
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))
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.1.tar.gz
(7.5 kB
view hashes)
Built Distribution
czech_eet-1.0.1-py3-none-any.whl
(10.3 kB
view hashes)
Close
Hashes for czech_eet-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2fad0b87403b341c6228c399361624cb720303af2a086645692612dec821b686 |
|
MD5 | 98c36b17d2976de920efea95b9c62e6d |
|
BLAKE2b-256 | e6152bb2afa65f8ee25318536943b1c4582f52d43d6ddfe80043eea5f1434196 |