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=PersonalIdType.NATIONAL_ID,
    identifier="номер_лична_карта"
)
print(f"Брой задължения - ФЛ/ЛК: {len(obligations)}\n")
print(f"Raw JSON: {obligations}\n")
# Проверка за физически лица -  шофьорска книжка:
obligations = await KatApiClient().get_obligations_individual(
    egn="валидно_егн",
    identifier_type=PersonalIdType.DRIVING_LICENSE,
    identifier="номер_шофьорска_книжка"
)
print(f"Брой задължения - ФЛ/ШК: {len(obligations)}\n")
print(f"Raw JSON: {obligations}\n")
# Проверка за юридически лица - лична карта:
obligations = await KatApiClient().get_obligations_business(
    egn="валидно_егн",
    identifier="номер_лична_карта",
    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.0b1.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.0b1-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kat_bulgaria-3.0.0b1.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.0b1.tar.gz
Algorithm Hash digest
SHA256 f6d007b59d51ad33d2c8b345fdc0a62d2dd1eff575197a3ab1c2000bb3a2a5ea
MD5 b00e9c2db42415afbe928466e1b6d507
BLAKE2b-256 627c6327b7f1dd68f5b9f639671079c1003de46a7c543bd77eee743cc4462b3a

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: kat_bulgaria-3.0.0b1-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.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 d39bf013ff561a27e119a7ae2d5725afb0f9c1e73217b4c82707d5a4826a7693
MD5 a279ace1574fcb35c3723405fbb88a14
BLAKE2b-256 bfb640a4e0ff813fba2c27c5f5e2fe333dd749ff9b464042a27f741ad4efa64b

See more details on using hashes here.

Provenance

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