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.

# For individuals:
# Validates EGN and Driver License Number locally and with the API.
is_valid = await KatApiClient().validate_credentials_individual(EGN, DRIVER_LICENSE)
print(f"Individual Credentials Valid: {is_valid}\n")

# Checks if an individual has obligations, returns true or false.
obligations = await KatApiClient().get_obligations_individual(EGN, DRIVER_LICENSE)
print(f"Individual Obligation Count: {len(obligations)}\n")
print(f"Raw: {obligations}\n")

################

# For businesses:
# Validates EGN, Government ID and BULSTAT locally and with the API.
is_valid = await KatApiClient().validate_credentials_business(EGN, GOVT_ID, BULSTAT)
print(f"Business Credentials Valid: {is_valid}\n")

# Checks if an individual has obligations, returns true or false.
obligations = await KatApiClient().get_obligations_business(EGN, GOVT_ID, BULSTAT)
print(f"Business Obligation Count: {len(obligations)}\n")
print(f"Raw: {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-2.1.0.tar.gz (8.9 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-2.1.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file kat_bulgaria-2.1.0.tar.gz.

File metadata

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

File hashes

Hashes for kat_bulgaria-2.1.0.tar.gz
Algorithm Hash digest
SHA256 09b9417ab2483a139bbac36606081d3e40c691f8829367c283cf762da3e5af6f
MD5 af4c88f5bc10fb8a71840c1c26719644
BLAKE2b-256 f3a019dad520ffa0763daf4fcff880758e638c68e274bba1ba347d2df20dc255

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: kat_bulgaria-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.8 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-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 37bb150f448a72820b1ba24ae14639f0f0d1993a541897c5d052301bf3629414
MD5 7d22cad9041cc87b261991abc8e9b079
BLAKE2b-256 a054d66383107cc427852e77cdb7b73f9ac8757d95038460c40e7598bafa45dc

See more details on using hashes here.

Provenance

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