Skip to main content

Validators for different russian banking values

Project description

vitya

WARNING: This library is still in development stage.

Validators for different russian banking values.
Values you can validate:

  • ИНН validate_inn
    • ИНН для ИП/Физ.Лица validate_inn_ip
    • ИНН для Юр.Лица validate_inn_le
  • КПП validate_kpp
  • БИК validate_bic
  • ОГРН validate_ogrn
    • ОГРНИП validate_ogrnip
  • СНИЛС validate_snils
  • ОКТМО validate_oktmo

You should pass value as str, otherwise exception will be raised.
If passed value is wrong, all functions will raise ValidationError.

Also, optionally, you can use validators as Pydantic fields

Examples:

validate_inn("3664069397")

try:
    validate_inn("770708389")
except ValidationError as e:
    print(f"wrong inn: {e}")
validate_kpp("616401001")
validate_bic("044525901")
validate_ogrn("1027700132195")
validate_snils("11223344595")
validate_oktmo("69701000001")
from pydantic import BaseModel, ValidationError
from vitya.pydantic_fields import INN


class InnModel(BaseModel):
    inn: INN


inn_model = InnModel(inn="302502032671")
assert inn_model.inn == "302502032671"

try:
    InnModel(inn="3664069398")
except ValidationError as e:
    print(e.errors())

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

vitya-0.16.0.tar.gz (18.8 kB view hashes)

Uploaded Source

Built Distribution

vitya-0.16.0-py3-none-any.whl (20.9 kB view hashes)

Uploaded Python 3

Supported by

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