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
Release history Release notifications | RSS feed
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.13.0.tar.gz
(16.5 kB
view hashes)
Built Distribution
vitya-0.13.0-py3-none-any.whl
(17.8 kB
view hashes)