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.0b3.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.0b3-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kat_bulgaria-3.0.0b3.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.0b3.tar.gz
Algorithm Hash digest
SHA256 66763b5146b952afbbb11c97f2739f01a9e4fab73a7b8171d7634f1c7e2978a7
MD5 424ad65f7311f835cf1110ee07e89a9f
BLAKE2b-256 522799f51cba9238094512175fa53d01ad75e263c2af9365bd0cb34f57c0060e

See more details on using hashes here.

Provenance

The following attestation bundles were made for kat_bulgaria-3.0.0b3.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.0b3-py3-none-any.whl.

File metadata

  • Download URL: kat_bulgaria-3.0.0b3-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.0b3-py3-none-any.whl
Algorithm Hash digest
SHA256 34a06722ece4812bf9da27bd7747c1ddebc3c9f72752162ca53678a6e3d2d0be
MD5 a1f3ed9a9963a7c744c0dfaaaedd679d
BLAKE2b-256 c772f1eab5e126af76e0c97aa821a2c48e63bf0372bcac2656786578ffee0e5f

See more details on using hashes here.

Provenance

The following attestation bundles were made for kat_bulgaria-3.0.0b3-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