Skip to main content

A library to check for existing obligations from KAT Bulgaria

Project description

Summary

PyPI Link Last release License PyPI Downloads Code size

This library allows you to check if you have fines from KAT Bulgaria programatically.

The code here is a simple wrapper around the API, providing you with error validation and type safety.

It does NOT save or log your data anywhere and it works with a single API endpoint.

The reason this library is needed is because the government website is highly unstable and often throws random errors and Timeouts. This library handles all known bad responses (as of the time of writing) and provides a meaningful error message and an error code for every request.


If you like my work, please consider donating

ko-fi


Installation

pip install kat_bulgaria

Example usage script:

For a full working sample usage script, check out sample_usage_script.py.

Remember to replace the dummy data in the constants with your own data.

# Проверка за физически лица - лична карта:
obligations = await KatApiClient().get_obligations_individual(
    egn="валидно_егн",
    identifier_type=PersonalDocumentType.NATIONAL_ID,
    identifier="номер_лична_карта"
)
print(f"Брой задължения - ФЛ/ЛК: {len(obligations)}\n")
print(f"Raw JSON: {obligations}\n")
# Проверка за физически лица -  шофьорска книжка:
obligations = await KatApiClient().get_obligations_individual(
    egn="валидно_егн",
    identifier_type=PersonalDocumentType.DRIVING_LICENSE,
    identifier="номер_шофьорска_книжка"
)
print(f"Брой задължения - ФЛ/ШК: {len(obligations)}\n")
print(f"Raw JSON: {obligations}\n")
# Проверка за юридически лица - лична карта:
obligations = await KatApiClient().get_obligations_business(
    egn="валидно_егн",
    govt_id="номер_лична_карта",
    bulstat="валиден_булстат"
)
print(f"Брой задължения - ЮЛ: {len(obligations)}\n")
print(f"Raw JSON: {obligations}\n")

Known raw API responses:

You can find sample API responses in /tests/fixtures.

I also document all sample responses in this issue for clarity.

If you have any fines, I would appreciate it if you attach the full JSON API response as a comment to the issue above.

You can get it by copying the url below and replacing EGN_GOES_HERE and LICENSE_GOES_HERE with your own data, then loading it in a browser.

https://e-uslugi.mvr.bg/api/Obligations/AND?obligatedPersonType=1&additinalDataForObligatedPersonType=1&mode=1&obligedPersonIdent=EGN_GOES_HERE&drivingLicenceNumber=LICENSE_GOES_HERE

After that place the JSON in any text editor and remove personal data, but do not change the JSON structure itself.

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

kat_bulgaria-3.0.0b4.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kat_bulgaria-3.0.0b4-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file kat_bulgaria-3.0.0b4.tar.gz.

File metadata

  • Download URL: kat_bulgaria-3.0.0b4.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for kat_bulgaria-3.0.0b4.tar.gz
Algorithm Hash digest
SHA256 2a9423f226f16f7126d93ef86077136eb09199497068aff94ef47dfd8ff1a737
MD5 cd263d8a671bb3193826c9669b25ba04
BLAKE2b-256 853d8d4801e67000d2efa1ce52ef116d1561935eedcec94776d769963837cbd5

See more details on using hashes here.

Provenance

The following attestation bundles were made for kat_bulgaria-3.0.0b4.tar.gz:

Publisher: on-release-publish.yml on Nedevski/py_kat_bulgaria

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kat_bulgaria-3.0.0b4-py3-none-any.whl.

File metadata

  • Download URL: kat_bulgaria-3.0.0b4-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for kat_bulgaria-3.0.0b4-py3-none-any.whl
Algorithm Hash digest
SHA256 2b2cde911b656c7fddd8814fde6145d300a85a00bae53cd89cac6e8199ec44a4
MD5 10b9652379734df2de73455d31368112
BLAKE2b-256 da79f647375cd25b9bf83ee049ea2197d590382b5f429bd1f268183f20fdb0a3

See more details on using hashes here.

Provenance

The following attestation bundles were made for kat_bulgaria-3.0.0b4-py3-none-any.whl:

Publisher: on-release-publish.yml on Nedevski/py_kat_bulgaria

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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