A library to check for existing obligations to KAT Bulgaria
Project description
Summary
This is a python library to check for obligations to KAT Bulgaria programatically.
It does NOT save or log your data anywhere and it works with a single HTTPS request.
Installation
pip install kat_bulgaria
Usage:
from kat_bulgaria.obligations import KatError, KatPersonDetails, check_obligations
egn = "0011223344"
driver_license_number = "123456789"
# Validates EGN and Driver License Number internally
# Throws ValueError on invalid input
person = KatPersonDetails(egn, driver_license_number)
try:
response = check_obligations(person)
except KatError as err:
print(f"Error: {str(err)}")
return
has_obligations = response.has_obligations
print(f"Has obligations: {has_obligations}")
Known raw API responses (debug info):
# No fines/obligations:
{"obligations":[],"hasNonHandedSlip":false}
# One or more fines/obligations, which have not been served
{"obligations":[],"hasNonHandedSlip":true}
# One or more fines/obligations, which *have* been served
### MISSING
# Invalid EGN or Driver License Number:
{"code":"GL_00038_E","message":"Няма данни за посоченото СУМПС/ЕГН или не се намира съответствие за издадено СУМПС на лице с посочения ЕГН/ЛНЧ"}
# The service is down, that happens a couple of times a day:
{"code":"GL_UNDELIVERED_AND_UNPAID_DEBTS_E","message":"По технически причини към момента не може да бъде извършена справка за невръчени и неплатени НП и/или електронни фишове по Закона за движението по пътищата и/или по Кодекса за застраховането."}
# Timeout:
# From time to time the API hangs and it takes more than 10s to load.
# You can retry immediately, you can wait a couple of minutes
# Господине, не виждате ли че сме в обедна почивка???
# At this point it's out of your hands
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
kat_bulgaria-0.2.1.tar.gz
(3.9 kB
view hashes)
Built Distribution
Close
Hashes for kat_bulgaria-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4763101fe11a0f43f83503b5f906fea373da05a359ad363dcd03c657593875d0 |
|
MD5 | 8cae4c1df0665a5b03e403db91eb2405 |
|
BLAKE2b-256 | 8549d4d89b6793efd10a3db9604c930cd706b70c0b544f7bf1eab0af7d9c7368 |