cdek.apps.models package

class cdek.apps.models.AccompanyingWaybill(*, client_name: str, flight_number: str | None = None, air_waybill_numbers: list[str] | None = None, vehicle_numbers: list[str] | None = None, vehicle_driver: str | None = None, planned_departure_date_time: datetime | None = None)[исходный код]

Базовые классы: BaseModel

air_waybill_numbers: list[str] | None
client_name: str
flight_number: str | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

planned_departure_date_time: datetime | None
serialize_planned_departure_date_time(planned_departure_date_time: datetime) str[исходный код]

Преобразовать дату отправления СНТ в строку ISO 8601

vehicle_driver: str | None
vehicle_numbers: list[str] | None
class cdek.apps.models.AdditionalService(*, code: str, parameter: str | None = None)[исходный код]

Базовые классы: BaseModel

code: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

parameter: str | None
class cdek.apps.models.Address(*, address: str | None = None, address_full: str | None = None)[исходный код]

Базовые классы: BaseModel

address: str | None
address_full: str | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class cdek.apps.models.BaseOrderLocation(*, postal_code: str | None = None, longitude: float | None = None, latitude: float | None = None, region: str | None = None, region_code: int | None = None, kladr_region_code: str | None = None, sub_region: str | None = None, country_code: Annotated[str | None, MaxLen(max_length=2)] = None, country: Annotated[str | None, MaxLen(max_length=255)] = None, code: int | None = None, city_uuid: UUID | None = None, city: str | None = None, fias_guid: UUID | None = None, time_zone: str | None = None)[исходный код]

Базовые классы: City, Country, Region, Coordinates, Zip

city: str | None
city_uuid: UUID | None
code: int | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

region: str | None
time_zone: str | None
class cdek.apps.models.CalcPackage(*, weight: int | None = None, length: int | None = None, width: int | None = None, height: int | None = None)[исходный код]

Базовые классы: BaseModel

height: int | None
length: int | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

weight: int | None
width: int | None
class cdek.apps.models.Call(*, failed_calls: list[FailedCall] | None = None, rescheduled_calls: list[RescheduledCall] | None = None)[исходный код]

Базовые классы: BaseModel

failed_calls: list[FailedCall] | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

rescheduled_calls: list[RescheduledCall] | None
class cdek.apps.models.City(*, code: int, city_uuid: UUID, city: str, fias_guid: UUID | None = None)[исходный код]

Базовые классы: BaseModel

city: str
city_uuid: UUID
code: int
fias_guid: UUID | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class cdek.apps.models.Contact(*, tin: ~typing.Annotated[str | None, ~annotated_types.MaxLen(max_length=255)] = None, passport_series: ~typing.Annotated[str | None, ~annotated_types.MaxLen(max_length=255)] = None, passport_number: ~typing.Annotated[str | None, ~annotated_types.MaxLen(max_length=255)] = None, passport_date_of_issue: ~datetime.date | None = None, passport_organization: ~typing.Annotated[str | None, ~annotated_types.MaxLen(max_length=255)] = None, passport_date_of_birth: ~datetime.date | None = None, company: str | None = None, name: str | None = None, contragent_type: ~cdek.apps.models.contact.ContragentType | None = None, email: str | None = None, phones: list[~cdek.apps.models.phone.Phone] = <factory>)[исходный код]

Базовые классы: Passport, Tin

add_phone(number: str, additional: str | None = None) Contact[исходный код]

Добавить новый номер телефона в контакт

company: str | None
contragent_type: ContragentType | None
email: str | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str | None
phones: list[Phone]
class cdek.apps.models.ContragentType(*values)[исходный код]

Базовые классы: str, Enum

INDIVIDUAL = 'INDIVIDUAL'
LEGAL_ENTITY = 'LEGAL_ENTITY'
class cdek.apps.models.Coordinates(*, longitude: float | None = None, latitude: float | None = None)[исходный код]

Базовые классы: BaseModel

latitude: float | None
longitude: float | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class cdek.apps.models.Country(*, country_code: Annotated[str | None, MaxLen(max_length=2)] = None, country: Annotated[str | None, MaxLen(max_length=255)] = None)[исходный код]

Базовые классы: BaseModel

country: str | None
country_code: str | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class cdek.apps.models.DeliveryCostThreshold(*, vat_sum: float | None = None, vat_rate: int | None = None, threshold: int | None = None, sum: float | None = None)[исходный код]

Базовые классы: Vat

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

sum: float | None
threshold: int | None
class cdek.apps.models.DeliveryDetail(*, date: date | None = None, recipient_name: str | None = None, payment_sum: float | None = None, delivery_sum: float | None = None, total_sum: float, payment_info: list[PaymentInfo] | None = None, delivery_vat_rate: float | None = None, delivery_vat_sum: float | None = None, delivery_discount_percent: float | None = None, delivery_discount_sum: float | None = None)[исходный код]

Базовые классы: BaseModel

date: Date | None
delivery_discount_percent: float | None
delivery_discount_sum: float | None
delivery_sum: float | None
delivery_vat_rate: float | None
delivery_vat_sum: float | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

payment_info: list[PaymentInfo] | None
payment_sum: float | None
recipient_name: str | None
serialize_date(date: date) str[исходный код]

Представить дату доставки в формате YYYY-MM-DD

total_sum: float
class cdek.apps.models.DeliveryProblem(*, code: str | None = None, create_date: datetime | None = None)[исходный код]

Базовые классы: BaseModel

code: str | None
create_date: datetime | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

serialize_create_date(create_date: datetime) str[исходный код]

Вернуть дату создания проблемы в формате ISO 8601

class cdek.apps.models.DeliveryRecipientCost(*, vat_sum: float | None = None, vat_rate: int | None = None, value: float | None = None)[исходный код]

Базовые классы: Money

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

value: float | None
class cdek.apps.models.Dimensions(*, width: int, height: int, depth: int)[исходный код]

Базовые классы: BaseModel

depth: int
height: int
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

width: int
class cdek.apps.models.EntityResponse(*, entity: RootEntity | None = None, requests: list[Request] | None = None, related_entities: list[RelatedEntity] | None = None)[исходный код]

Базовые классы: BaseModel

Модель ответа о сущности.

entity: RootEntity | None
get_entity() RootEntity | None[исходный код]

Получить данные сущности.

get_entry_uuid() str | None[исходный код]

Получить UUID сущности.

get_requests() list[Request][исходный код]

Получить список запросов.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

related_entities: list[RelatedEntity] | None
requests: list[Request] | None
class cdek.apps.models.Error(*, code: str | None = None, additional_code: str | None = None, message: str | None = None)[исходный код]

Базовые классы: BaseModel

Ошибки

additional_code: str | None
code: str | None
message: str | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class cdek.apps.models.FailedCall(*, date_time: datetime, reason_code: int)[исходный код]

Базовые классы: BaseModel

date_time: datetime
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

reason_code: int
serialize_date_time(date_time: datetime) str[исходный код]

Представить дату и время недозвона в формате ISO 8601

class cdek.apps.models.FullLocation(*, postal_code: str | None = None, address: str | None = None, address_full: str | None = None, longitude: float | None = None, latitude: float | None = None, region: Annotated[str, MaxLen(max_length=255)], region_code: int | None = None, kladr_region_code: str | None = None, sub_region: str | None = None, country_code: Annotated[str | None, MaxLen(max_length=2)] = None, country: Annotated[str | None, MaxLen(max_length=255)] = None, code: int, city_uuid: UUID, city: str, fias_guid: UUID | None = None)[исходный код]

Базовые классы: City, Country, Region, Coordinates, Address, Zip

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class cdek.apps.models.Image(*, number: int | None = 0, url: Annotated[str, MaxLen(max_length=255)])[исходный код]

Базовые классы: BaseModel

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

number: int | None
url: str
class cdek.apps.models.IntakeLocation(*, address: str, address_full: str | None = None, postal_code: str | None = None, longitude: float | None = None, latitude: float | None = None, region: str | None = None, region_code: int | None = None, kladr_region_code: str | None = None, sub_region: str | None = None, country_code: Annotated[str | None, MaxLen(max_length=2)] = None, country: Annotated[str | None, MaxLen(max_length=255)] = None, code: int, city_uuid: str | None = None, city: str | None = None, fias_guid: UUID | None = None)[исходный код]

Базовые классы: City, Country, Region, Coordinates, Zip, Address

address: str
city: str | None
city_uuid: str | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

region: str | None
class cdek.apps.models.Intakes(*, cdek_number: str | None = None, order_uuid: UUID | None = None, intake_date: date, intake_time_from: str, intake_time_to: str, lunch_time_from: str, lunch_time_to: str, name: str | None = None, weight: int | None = None, length: int | None = None, width: int | None = None, height: int | None = None, comment: str | None = None, courier_power_of_attorney: bool | None = None, courier_identity_card: bool | None = None, sender: Contact | None = None, from_location: IntakeLocation | None = None, need_call: bool = False)[исходный код]

Базовые классы: BaseModel

cdek_number: str | None
comment: str | None
courier_identity_card: bool | None
courier_power_of_attorney: bool | None
from_location: IntakeLocation | None
from_location_init(**kwargs: Any) IntakeLocation[исходный код]

Создать объект адреса забора по переданным параметрам

height: int | None
intake_date: Date
intake_time_from: str
intake_time_to: str
length: int | None
lunch_time_from: str
lunch_time_to: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str | None
need_call: bool
order_uuid: UUID | None
sender: Contact | None
sender_init(**kwargs: Any) Contact[исходный код]

Создать объект контакта заказчика

serialize_intake_date(intake_date: date) str[исходный код]

Представить дату забора в формате YYYY-MM-DD

set_from_location(location: IntakeLocation) Intakes[исходный код]

Указать место забора

set_sender(sender: Contact) Intakes[исходный код]

Установить контактные данные заказчика

weight: int | None
width: int | None
class cdek.apps.models.Item(*, name: str, ware_key: str, marking: str | None = None, payment: Money, weight: int, weight_gross: int | None = None, amount: int, name_i18n: str | None = None, brand: str | None = None, country_code: str | None = None, material: int | None = None, wifi_gsm: bool | None = None, url: str | None = None, seller: Seller | None = None, cost: float, feacn_code: str | None = None, jewel_uin: str | None = None, used_goods: bool | None = None)[исходный код]

Базовые классы: BaseModel

amount: int
brand: str | None
cost: float
country_code: str | None
feacn_code: str | None
jewel_uin: str | None
marking: str | None
material: int | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str
name_i18n: str | None
payment: Money
seller: Seller | None
url: str | None
used_goods: bool | None
ware_key: str
weight: int
weight_gross: int | None
wifi_gsm: bool | None
class cdek.apps.models.Money(*, vat_sum: float | None = None, vat_rate: int | None = None, value: float | None = None)[исходный код]

Базовые классы: Vat

Модель для денежных сумм и НДС.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

value: float | None
class cdek.apps.models.Order(*, type: int | None = None, number: str | None = None, accompanying_number: str | None = None, tariff_code: int, comment: str | None = None, shipment_point: str | None = None, delivery_point: str | None = None, delivery_recipient_cost: ~cdek.apps.models.order.DeliveryRecipientCost | None = None, delivery_recipient_cost_adv: list[~cdek.apps.models.order.DeliveryCostThreshold] | None = None, sender: ~cdek.apps.models.contact.Contact | None = None, seller: ~cdek.apps.models.seller.Seller | None = None, recipient: ~cdek.apps.models.contact.Contact, from_location: ~cdek.apps.models.location.OrderLocation | None = None, to_location: ~cdek.apps.models.location.OrderLocation | None = None, services: list[~cdek.apps.models.order.AdditionalService] | None = None, packages: list[~cdek.apps.models.package.Package] = <factory>, has_reverse_order: bool | None = None, additional_order_types: list[int] | None = None, date_invoice: ~datetime.date | None = None, shipper_name: str | None = None, shipper_address: str | None = None, is_client_return: bool | None = None)[исходный код]

Базовые классы: UpdateOrder

add_package(package: Package) Order[исходный код]

Добавить упаковку в список пакетов заказа

additional_order_types: list[int] | None
date_invoice: Date | None
is_client_return: bool | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

packages: list[Package]
serialize_date_invoice(date_invoice: date) str[исходный код]

Вернуть дату инвойса в формате YYYY-MM-DD

services: list[AdditionalService] | None
shipper_address: str | None
shipper_name: str | None
tariff_code: int
class cdek.apps.models.OrderInfo(*, cdek_number: int | None = None, order_uuid: str | None = None)[исходный код]

Базовые классы: BaseModel

cdek_number: int | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

order_uuid: str | None
class cdek.apps.models.OrderLocation(*, postal_code: str | None = None, longitude: float | None = None, latitude: float | None = None, region: str | None = None, region_code: int | None = None, kladr_region_code: str | None = None, sub_region: str | None = None, country_code: Annotated[str | None, MaxLen(max_length=2)] = None, country: Annotated[str | None, MaxLen(max_length=255)] = None, code: int | None = None, city_uuid: UUID | None = None, city: str | None = None, fias_guid: UUID | None = None, time_zone: str | None = None, address: str)[исходный код]

Базовые классы: BaseOrderLocation

address: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class cdek.apps.models.OrderStatus(*, code: str | None = None, name: str | None = None, date_time: datetime | None = None, reason_code: str | None = None, city: str | None = None, city_uuid: str | None = None, deleted: bool | None = None)[исходный код]

Базовые классы: BaseModel

Статус заказа.

city: str | None
city_uuid: str | None
code: str | None
date_time: datetime | None
deleted: bool | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str | None
reason_code: str | None
serialize_date_time(date_time: datetime) str[исходный код]

Вернуть время установки статуса в формате ISO 8601

class cdek.apps.models.Package(*, weight: int, length: int | None = None, width: int | None = None, height: int | None = None, number: str, comment: str | None = None, items: list[Item] | None = None, package_id: str | None = None)[исходный код]

Базовые классы: CalcPackage

add_item(**kwargs: Any) Item[исходный код]

Добавить товар в упаковку и вернуть созданный объект

comment: str | None
items: list[Item] | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

number: str
package_id: str | None
weight: int
class cdek.apps.models.Passport(*, passport_series: Annotated[str | None, MaxLen(max_length=255)] = None, passport_number: Annotated[str | None, MaxLen(max_length=255)] = None, passport_date_of_issue: date | None = None, passport_organization: Annotated[str | None, MaxLen(max_length=255)] = None, passport_date_of_birth: date | None = None)[исходный код]

Базовые классы: BaseModel

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

passport_date_of_birth: Date | None
passport_date_of_issue: Date | None
passport_number: str | None
passport_organization: str | None
passport_series: str | None
serialize_passport_date_of_birth(passport_date_of_birth: date) str[исходный код]

Вернуть дату рождения в формате YYYY-MM-DD

serialize_passport_date_of_issue(passport_date_of_issue: date) str[исходный код]

Вернуть дату выдачи паспорта в формате YYYY-MM-DD

class cdek.apps.models.PaymentInfo(*, sum: float, type: Literal['CASH', 'CARD'])[исходный код]

Базовые классы: BaseModel

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

sum: float
type: Literal['CASH', 'CARD']
class cdek.apps.models.Phone(*, number: Annotated[str, MaxLen(max_length=24)], additional: Annotated[str | None, MaxLen(max_length=255)] = None)[исходный код]

Базовые классы: BaseModel

Модель для телефонного номера.

additional: str | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

number: str
class cdek.apps.models.PrintForm(*, orders: list[PrintOrder], copy_count: int | None = None)[исходный код]

Базовые классы: BaseModel

copy_count: int | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

orders: list[PrintOrder]
class cdek.apps.models.PrintOrder(*, order_uuid: str | None = None, cdek_number: int | None = None)[исходный код]

Базовые классы: BaseModel

cdek_number: int | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

order_uuid: str | None
class cdek.apps.models.PrintType(*values)[исходный код]

Базовые классы: str, Enum

Типы печатной формы

tpl_armenia = 'tpl_armenia'
tpl_china = 'tpl_china'
tpl_czech = 'tpl_czech'
tpl_english = 'tpl_english'
tpl_german = 'tpl_german'
tpl_invoice = 'tpl_invoice'
tpl_italian = 'tpl_italian'
tpl_korean = 'tpl_korean'
tpl_latvian = 'tpl_latvian'
tpl_lithuanian = 'tpl_lithuanian'
tpl_russia = 'tpl_russia'
tpl_thailand = 'tpl_thailand'
tpl_turkish = 'tpl_turkish'
class cdek.apps.models.Region(*, region: Annotated[str, MaxLen(max_length=255)], region_code: int | None = None, kladr_region_code: str | None = None, sub_region: str | None = None)[исходный код]

Базовые классы: BaseModel

kladr_region_code: str | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

region: str
region_code: int | None
sub_region: str | None
class cdek.apps.models.RelatedEntity(*, uuid: UUID | None = None, type: RelatedEntityType, url: Annotated[str | None, MaxLen(max_length=255)] = None, create_time: datetime | None = None, cdek_number: Annotated[str | None, MaxLen(max_length=255)] = None, date: date | None = None, time_from: str | None = None, time_to: str | None = None)[исходный код]

Базовые классы: BaseModel

Связанные сущности

cdek_number: str | None
classmethod convert_type_to_upper(v: str) str[исходный код]

Преобразование типа в верхний регистр перед валидацией

create_time: datetime | None
date: Date | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

serialize_create_time(create_time: datetime) str[исходный код]

Конвертировать время создания в строку ISO

serialize_date(date: date) str[исходный код]

Конвертировать дату доставки в формат YYYY-MM-DD

time_from: str | None
time_to: str | None
type: RelatedEntityType
url: str | None
uuid: UUID | None
class cdek.apps.models.RelatedEntityType(*values)[исходный код]

Базовые классы: str, Enum

Типы связанных сущностей

BARCODE = 'BARCODE'
CLIENT_DIRECT_ORDER = 'CLIENT_DIRECT_ORDER'
CLIENT_RETURN_ORDER = 'CLIENT_RETURN_ORDER'
DELIVERY = 'DELIVERY'
DIRECT_ORDER = 'DIRECT_ORDER'
RETURN_ORDER = 'RETURN_ORDER'
REVERSE_ORDER = 'REVERSE_ORDER'
WAYBILL = 'WAYBILL'
class cdek.apps.models.Request(*, request_uuid: UUID | None = None, type: Literal['CREATE', 'UPDATE', 'DELETE', 'AUTH', 'GET', 'CREATE_CLIENT_RETURN', 'CREATE_REFUSAL'], date_time: datetime, state: Annotated[Literal['ACCEPTED', 'WAITING', 'SUCCESSFUL', 'INVALID'], MaxLen(max_length=255)], errors: list[Error] | None = None, warnings: list[WarningModel] | None = None)[исходный код]

Базовые классы: BaseModel

Модель ответа о запросе.

date_time: datetime
errors: list[Error] | None
get_state() str | None[исходный код]

Получить состояние запроса.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

request_uuid: UUID | None
serialize_date_time(date_time: datetime) str[исходный код]

Представить дату последнего изменения запроса в формате ISO

state: Literal['ACCEPTED', 'WAITING', 'SUCCESSFUL', 'INVALID']
type: Literal['CREATE', 'UPDATE', 'DELETE', 'AUTH', 'GET', 'CREATE_CLIENT_RETURN', 'CREATE_REFUSAL']
warnings: list[WarningModel] | None
class cdek.apps.models.RescheduledCall(*, date_time: datetime, date_next: date, time_next: str, comment: str | None = None)[исходный код]

Базовые классы: BaseModel

comment: str | None
date_next: Date
date_time: datetime
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

serialize_date_next(date_next: date) str[исходный код]

Вернуть дату следующего прозвона в формате YYYY-MM-DD

serialize_date_time(date_time: datetime) str[исходный код]

Представить дату создания переноса прозвона в формате ISO 8601

time_next: str
class cdek.apps.models.RootEntity(*, uuid: UUID)[исходный код]

Базовые классы: BaseModel

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

uuid: UUID
class cdek.apps.models.Seller(*, name: str | None = None, inn: str | None = None, phone: str | None = None, ownership_form: int | None = None, address: str | None = None)[исходный код]

Базовые классы: BaseModel

Модель для реквизитов истинного продавца

address: str | None
inn: str | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str | None
ownership_form: int | None
phone: str | None
class cdek.apps.models.Status(*, code: str, name: str, date_time: datetime)[исходный код]

Базовые классы: BaseModel

code: str
date_time: datetime
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str
serialize_date_time(date_time: datetime) str[исходный код]

Преобразовать дату статуса в строку формата ISO

class cdek.apps.models.Tin(*, tin: Annotated[str | None, MaxLen(max_length=255)] = None)[исходный код]

Базовые классы: BaseModel

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

tin: str | None
class cdek.apps.models.UpdateOrder(*, type: int | None = None, number: str | None = None, accompanying_number: str | None = None, tariff_code: int | None = None, comment: str | None = None, shipment_point: str | None = None, delivery_point: str | None = None, delivery_recipient_cost: DeliveryRecipientCost | None = None, delivery_recipient_cost_adv: list[DeliveryCostThreshold] | None = None, sender: Contact | None = None, seller: Seller | None = None, recipient: Contact, from_location: OrderLocation | None = None, to_location: OrderLocation | None = None, services: list[AdditionalService] | None = None, packages: list[Package] | None = None, has_reverse_order: bool | None = None)[исходный код]

Базовые классы: BaseModel

accompanying_number: str | None
comment: str | None
classmethod contact_init(**kwargs: Any) Contact[исходный код]

Создать объект контакта отправителя или получателя

delivery_point: str | None
delivery_recipient_cost: DeliveryRecipientCost | None
delivery_recipient_cost_adv: list[DeliveryCostThreshold] | None
from_location: OrderLocation | None
has_reverse_order: bool | None
classmethod location_init(**kwargs: Any) OrderLocation[исходный код]

Создать объект адреса заказа с указанными полями

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

number: str | None
classmethod package_init(**kwargs: Any) Package[исходный код]

Создать объект упаковки по переданным параметрам

packages: list[Package] | None
recipient: Contact
seller: Seller | None
classmethod seller_init(**kwargs: Any) Seller[исходный код]

Создать объект продавца по переданным параметрам

sender: Contact | None
services: list[AdditionalService] | None
set_contact(sender: Contact) Order[исходный код]

Сохранить контактные данные отправителя

set_delivery_point(code: str) Order[исходный код]

Задать код ПВЗ СДЭК

set_from_location(location: OrderLocation) Order[исходный код]

Задать адрес отправления

set_recipient(recipient: Contact) Order[исходный код]

Сохранить контактные данные получателя

set_seller(seller: Seller) Order[исходный код]

Установить продавца для текущего заказа

set_shipment_point(code: str) Order[исходный код]

Задать код ПВЗ СДЭК

set_to_location(location: OrderLocation) Order[исходный код]

Задать адрес доставки

shipment_point: str | None
tariff_code: int | None
to_location: OrderLocation | None
type: int | None
class cdek.apps.models.Vat(*, vat_sum: float | None = None, vat_rate: int | None = None)[исходный код]

Базовые классы: BaseModel

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

vat_rate: int | None
vat_sum: float | None
class cdek.apps.models.WarningModel(*, code: str | None = None, message: str | None = None)[исходный код]

Базовые классы: BaseModel

Предупреждения

code: str | None
message: str | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class cdek.apps.models.WorkTime(*, day: int, time: Annotated[str, MaxLen(max_length=255)])[исходный код]

Базовые классы: BaseModel

day: int
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

time: str
class cdek.apps.models.WorkTimeException(*, date_start: date, date_end: date, time_start: str | None = None, time_end: str | None = None, is_working: bool)[исходный код]

Базовые классы: BaseModel

date_end: Date
date_start: Date
is_working: bool
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

serialize_date_end(date_end: date) str[исходный код]

Представить дату окончания исключения в формате ISO

serialize_date_start(date_start: date) str[исходный код]

Представить дату начала исключения в формате ISO

time_end: str | None
time_start: str | None
class cdek.apps.models.Zip(*, postal_code: str | None = None)[исходный код]

Базовые классы: BaseModel

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

postal_code: str | None

Submodules

cdek.apps.models.contact module

class cdek.apps.models.contact.Contact(*, tin: ~typing.Annotated[str | None, ~annotated_types.MaxLen(max_length=255)] = None, passport_series: ~typing.Annotated[str | None, ~annotated_types.MaxLen(max_length=255)] = None, passport_number: ~typing.Annotated[str | None, ~annotated_types.MaxLen(max_length=255)] = None, passport_date_of_issue: ~datetime.date | None = None, passport_organization: ~typing.Annotated[str | None, ~annotated_types.MaxLen(max_length=255)] = None, passport_date_of_birth: ~datetime.date | None = None, company: str | None = None, name: str | None = None, contragent_type: ~cdek.apps.models.contact.ContragentType | None = None, email: str | None = None, phones: list[~cdek.apps.models.phone.Phone] = <factory>)[исходный код]

Базовые классы: Passport, Tin

add_phone(number: str, additional: str | None = None) Contact[исходный код]

Добавить новый номер телефона в контакт

company: str | None
contragent_type: ContragentType | None
email: str | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str | None
passport_date_of_birth: Date | None
passport_date_of_issue: Date | None
passport_number: str | None
passport_organization: str | None
passport_series: str | None
phones: list[Phone]
tin: str | None
class cdek.apps.models.contact.ContragentType(*values)[исходный код]

Базовые классы: str, Enum

INDIVIDUAL = 'INDIVIDUAL'
LEGAL_ENTITY = 'LEGAL_ENTITY'
class cdek.apps.models.contact.Passport(*, passport_series: Annotated[str | None, MaxLen(max_length=255)] = None, passport_number: Annotated[str | None, MaxLen(max_length=255)] = None, passport_date_of_issue: date | None = None, passport_organization: Annotated[str | None, MaxLen(max_length=255)] = None, passport_date_of_birth: date | None = None)[исходный код]

Базовые классы: BaseModel

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

passport_date_of_birth: Date | None
passport_date_of_issue: Date | None
passport_number: str | None
passport_organization: str | None
passport_series: str | None
serialize_passport_date_of_birth(passport_date_of_birth: date) str[исходный код]

Вернуть дату рождения в формате YYYY-MM-DD

serialize_passport_date_of_issue(passport_date_of_issue: date) str[исходный код]

Вернуть дату выдачи паспорта в формате YYYY-MM-DD

class cdek.apps.models.contact.Tin(*, tin: Annotated[str | None, MaxLen(max_length=255)] = None)[исходный код]

Базовые классы: BaseModel

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

tin: str | None

cdek.apps.models.dimensions module

class cdek.apps.models.dimensions.Dimensions(*, width: int, height: int, depth: int)[исходный код]

Базовые классы: BaseModel

depth: int
height: int
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

width: int

cdek.apps.models.entity_response module

class cdek.apps.models.entity_response.EntityResponse(*, entity: RootEntity | None = None, requests: list[Request] | None = None, related_entities: list[RelatedEntity] | None = None)[исходный код]

Базовые классы: BaseModel

Модель ответа о сущности.

entity: RootEntity | None
get_entity() RootEntity | None[исходный код]

Получить данные сущности.

get_entry_uuid() str | None[исходный код]

Получить UUID сущности.

get_requests() list[Request][исходный код]

Получить список запросов.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

related_entities: list[RelatedEntity] | None
requests: list[Request] | None
class cdek.apps.models.entity_response.RootEntity(*, uuid: UUID)[исходный код]

Базовые классы: BaseModel

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

uuid: UUID

cdek.apps.models.error module

class cdek.apps.models.error.Error(*, code: str | None = None, additional_code: str | None = None, message: str | None = None)[исходный код]

Базовые классы: BaseModel

Ошибки

additional_code: str | None
code: str | None
message: str | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

cdek.apps.models.image module

class cdek.apps.models.image.Image(*, number: int | None = 0, url: Annotated[str, MaxLen(max_length=255)])[исходный код]

Базовые классы: BaseModel

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

number: int | None
url: str

cdek.apps.models.intakes module

class cdek.apps.models.intakes.IntakeLocation(*, address: str, address_full: str | None = None, postal_code: str | None = None, longitude: float | None = None, latitude: float | None = None, region: str | None = None, region_code: int | None = None, kladr_region_code: str | None = None, sub_region: str | None = None, country_code: Annotated[str | None, MaxLen(max_length=2)] = None, country: Annotated[str | None, MaxLen(max_length=255)] = None, code: int, city_uuid: str | None = None, city: str | None = None, fias_guid: UUID | None = None)[исходный код]

Базовые классы: City, Country, Region, Coordinates, Zip, Address

address: str
address_full: str | None
city: str | None
city_uuid: str | None
code: int
country: str | None
country_code: str | None
fias_guid: UUID | None
kladr_region_code: str | None
latitude: float | None
longitude: float | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

postal_code: str | None
region: str | None
region_code: int | None
sub_region: str | None
class cdek.apps.models.intakes.Intakes(*, cdek_number: str | None = None, order_uuid: UUID | None = None, intake_date: date, intake_time_from: str, intake_time_to: str, lunch_time_from: str, lunch_time_to: str, name: str | None = None, weight: int | None = None, length: int | None = None, width: int | None = None, height: int | None = None, comment: str | None = None, courier_power_of_attorney: bool | None = None, courier_identity_card: bool | None = None, sender: Contact | None = None, from_location: IntakeLocation | None = None, need_call: bool = False)[исходный код]

Базовые классы: BaseModel

cdek_number: str | None
comment: str | None
courier_identity_card: bool | None
courier_power_of_attorney: bool | None
from_location: IntakeLocation | None
from_location_init(**kwargs: Any) IntakeLocation[исходный код]

Создать объект адреса забора по переданным параметрам

height: int | None
intake_date: Date
intake_time_from: str
intake_time_to: str
length: int | None
lunch_time_from: str
lunch_time_to: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str | None
need_call: bool
order_uuid: UUID | None
sender: Contact | None
sender_init(**kwargs: Any) Contact[исходный код]

Создать объект контакта заказчика

serialize_intake_date(intake_date: date) str[исходный код]

Представить дату забора в формате YYYY-MM-DD

set_from_location(location: IntakeLocation) Intakes[исходный код]

Указать место забора

set_sender(sender: Contact) Intakes[исходный код]

Установить контактные данные заказчика

weight: int | None
width: int | None

cdek.apps.models.item module

class cdek.apps.models.item.Item(*, name: str, ware_key: str, marking: str | None = None, payment: Money, weight: int, weight_gross: int | None = None, amount: int, name_i18n: str | None = None, brand: str | None = None, country_code: str | None = None, material: int | None = None, wifi_gsm: bool | None = None, url: str | None = None, seller: Seller | None = None, cost: float, feacn_code: str | None = None, jewel_uin: str | None = None, used_goods: bool | None = None)[исходный код]

Базовые классы: BaseModel

amount: int
brand: str | None
cost: float
country_code: str | None
feacn_code: str | None
jewel_uin: str | None
marking: str | None
material: int | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str
name_i18n: str | None
payment: Money
seller: Seller | None
url: str | None
used_goods: bool | None
ware_key: str
weight: int
weight_gross: int | None
wifi_gsm: bool | None

cdek.apps.models.location module

class cdek.apps.models.location.Address(*, address: str | None = None, address_full: str | None = None)[исходный код]

Базовые классы: BaseModel

address: str | None
address_full: str | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class cdek.apps.models.location.BaseOrderLocation(*, postal_code: str | None = None, longitude: float | None = None, latitude: float | None = None, region: str | None = None, region_code: int | None = None, kladr_region_code: str | None = None, sub_region: str | None = None, country_code: Annotated[str | None, MaxLen(max_length=2)] = None, country: Annotated[str | None, MaxLen(max_length=255)] = None, code: int | None = None, city_uuid: UUID | None = None, city: str | None = None, fias_guid: UUID | None = None, time_zone: str | None = None)[исходный код]

Базовые классы: City, Country, Region, Coordinates, Zip

city: str | None
city_uuid: UUID | None
code: int | None
country: str | None
country_code: str | None
fias_guid: UUID | None
kladr_region_code: str | None
latitude: float | None
longitude: float | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

postal_code: str | None
region: str | None
region_code: int | None
sub_region: str | None
time_zone: str | None
class cdek.apps.models.location.City(*, code: int, city_uuid: UUID, city: str, fias_guid: UUID | None = None)[исходный код]

Базовые классы: BaseModel

city: str
city_uuid: UUID
code: int
fias_guid: UUID | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class cdek.apps.models.location.Coordinates(*, longitude: float | None = None, latitude: float | None = None)[исходный код]

Базовые классы: BaseModel

latitude: float | None
longitude: float | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class cdek.apps.models.location.Country(*, country_code: Annotated[str | None, MaxLen(max_length=2)] = None, country: Annotated[str | None, MaxLen(max_length=255)] = None)[исходный код]

Базовые классы: BaseModel

country: str | None
country_code: str | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class cdek.apps.models.location.FullLocation(*, postal_code: str | None = None, address: str | None = None, address_full: str | None = None, longitude: float | None = None, latitude: float | None = None, region: Annotated[str, MaxLen(max_length=255)], region_code: int | None = None, kladr_region_code: str | None = None, sub_region: str | None = None, country_code: Annotated[str | None, MaxLen(max_length=2)] = None, country: Annotated[str | None, MaxLen(max_length=255)] = None, code: int, city_uuid: UUID, city: str, fias_guid: UUID | None = None)[исходный код]

Базовые классы: City, Country, Region, Coordinates, Address, Zip

address: str | None
address_full: str | None
city: str
city_uuid: UUID
code: int
country: str | None
country_code: str | None
fias_guid: UUID | None
kladr_region_code: str | None
latitude: float | None
longitude: float | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

postal_code: str | None
region: str
region_code: int | None
sub_region: str | None
class cdek.apps.models.location.OrderLocation(*, postal_code: str | None = None, longitude: float | None = None, latitude: float | None = None, region: str | None = None, region_code: int | None = None, kladr_region_code: str | None = None, sub_region: str | None = None, country_code: Annotated[str | None, MaxLen(max_length=2)] = None, country: Annotated[str | None, MaxLen(max_length=255)] = None, code: int | None = None, city_uuid: UUID | None = None, city: str | None = None, fias_guid: UUID | None = None, time_zone: str | None = None, address: str)[исходный код]

Базовые классы: BaseOrderLocation

address: str
city: str | None
city_uuid: UUID | None
code: int | None
country: str | None
country_code: str | None
fias_guid: UUID | None
kladr_region_code: str | None
latitude: float | None
longitude: float | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

postal_code: str | None
region: str | None
region_code: int | None
sub_region: str | None
time_zone: str | None
class cdek.apps.models.location.Region(*, region: Annotated[str, MaxLen(max_length=255)], region_code: int | None = None, kladr_region_code: str | None = None, sub_region: str | None = None)[исходный код]

Базовые классы: BaseModel

kladr_region_code: str | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

region: str
region_code: int | None
sub_region: str | None
class cdek.apps.models.location.Zip(*, postal_code: str | None = None)[исходный код]

Базовые классы: BaseModel

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

postal_code: str | None

cdek.apps.models.money module

class cdek.apps.models.money.Money(*, vat_sum: float | None = None, vat_rate: int | None = None, value: float | None = None)[исходный код]

Базовые классы: Vat

Модель для денежных сумм и НДС.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

value: float | None
vat_rate: int | None
vat_sum: float | None
class cdek.apps.models.money.Vat(*, vat_sum: float | None = None, vat_rate: int | None = None)[исходный код]

Базовые классы: BaseModel

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

vat_rate: int | None
vat_sum: float | None

cdek.apps.models.order module

class cdek.apps.models.order.AccompanyingWaybill(*, client_name: str, flight_number: str | None = None, air_waybill_numbers: list[str] | None = None, vehicle_numbers: list[str] | None = None, vehicle_driver: str | None = None, planned_departure_date_time: datetime | None = None)[исходный код]

Базовые классы: BaseModel

air_waybill_numbers: list[str] | None
client_name: str
flight_number: str | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

planned_departure_date_time: datetime | None
serialize_planned_departure_date_time(planned_departure_date_time: datetime) str[исходный код]

Преобразовать дату отправления СНТ в строку ISO 8601

vehicle_driver: str | None
vehicle_numbers: list[str] | None
class cdek.apps.models.order.AdditionalService(*, code: str, parameter: str | None = None)[исходный код]

Базовые классы: BaseModel

code: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

parameter: str | None
class cdek.apps.models.order.Call(*, failed_calls: list[FailedCall] | None = None, rescheduled_calls: list[RescheduledCall] | None = None)[исходный код]

Базовые классы: BaseModel

failed_calls: list[FailedCall] | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

rescheduled_calls: list[RescheduledCall] | None
class cdek.apps.models.order.DeliveryCostThreshold(*, vat_sum: float | None = None, vat_rate: int | None = None, threshold: int | None = None, sum: float | None = None)[исходный код]

Базовые классы: Vat

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

sum: float | None
threshold: int | None
vat_rate: int | None
vat_sum: float | None
class cdek.apps.models.order.DeliveryDetail(*, date: date | None = None, recipient_name: str | None = None, payment_sum: float | None = None, delivery_sum: float | None = None, total_sum: float, payment_info: list[PaymentInfo] | None = None, delivery_vat_rate: float | None = None, delivery_vat_sum: float | None = None, delivery_discount_percent: float | None = None, delivery_discount_sum: float | None = None)[исходный код]

Базовые классы: BaseModel

date: Date | None
delivery_discount_percent: float | None
delivery_discount_sum: float | None
delivery_sum: float | None
delivery_vat_rate: float | None
delivery_vat_sum: float | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

payment_info: list[PaymentInfo] | None
payment_sum: float | None
recipient_name: str | None
serialize_date(date: date) str[исходный код]

Представить дату доставки в формате YYYY-MM-DD

total_sum: float
class cdek.apps.models.order.DeliveryProblem(*, code: str | None = None, create_date: datetime | None = None)[исходный код]

Базовые классы: BaseModel

code: str | None
create_date: datetime | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

serialize_create_date(create_date: datetime) str[исходный код]

Вернуть дату создания проблемы в формате ISO 8601

class cdek.apps.models.order.DeliveryRecipientCost(*, vat_sum: float | None = None, vat_rate: int | None = None, value: float | None = None)[исходный код]

Базовые классы: Money

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

value: float | None
vat_rate: int | None
vat_sum: float | None
class cdek.apps.models.order.FailedCall(*, date_time: datetime, reason_code: int)[исходный код]

Базовые классы: BaseModel

date_time: datetime
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

reason_code: int
serialize_date_time(date_time: datetime) str[исходный код]

Представить дату и время недозвона в формате ISO 8601

class cdek.apps.models.order.Order(*, type: int | None = None, number: str | None = None, accompanying_number: str | None = None, tariff_code: int, comment: str | None = None, shipment_point: str | None = None, delivery_point: str | None = None, delivery_recipient_cost: ~cdek.apps.models.order.DeliveryRecipientCost | None = None, delivery_recipient_cost_adv: list[~cdek.apps.models.order.DeliveryCostThreshold] | None = None, sender: ~cdek.apps.models.contact.Contact | None = None, seller: ~cdek.apps.models.seller.Seller | None = None, recipient: ~cdek.apps.models.contact.Contact, from_location: ~cdek.apps.models.location.OrderLocation | None = None, to_location: ~cdek.apps.models.location.OrderLocation | None = None, services: list[~cdek.apps.models.order.AdditionalService] | None = None, packages: list[~cdek.apps.models.package.Package] = <factory>, has_reverse_order: bool | None = None, additional_order_types: list[int] | None = None, date_invoice: ~datetime.date | None = None, shipper_name: str | None = None, shipper_address: str | None = None, is_client_return: bool | None = None)[исходный код]

Базовые классы: UpdateOrder

accompanying_number: str | None
add_package(package: Package) Order[исходный код]

Добавить упаковку в список пакетов заказа

additional_order_types: list[int] | None
comment: str | None
date_invoice: Date | None
delivery_point: str | None
delivery_recipient_cost: DeliveryRecipientCost | None
delivery_recipient_cost_adv: list[DeliveryCostThreshold] | None
from_location: OrderLocation | None
has_reverse_order: bool | None
is_client_return: bool | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

number: str | None
packages: list[Package]
recipient: Contact
seller: Seller | None
sender: Contact | None
serialize_date_invoice(date_invoice: date) str[исходный код]

Вернуть дату инвойса в формате YYYY-MM-DD

services: list[AdditionalService] | None
shipment_point: str | None
shipper_address: str | None
shipper_name: str | None
tariff_code: int
to_location: OrderLocation | None
type: int | None
class cdek.apps.models.order.OrderInfo(*, cdek_number: int | None = None, order_uuid: str | None = None)[исходный код]

Базовые классы: BaseModel

cdek_number: int | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

order_uuid: str | None
class cdek.apps.models.order.OrderStatus(*, code: str | None = None, name: str | None = None, date_time: datetime | None = None, reason_code: str | None = None, city: str | None = None, city_uuid: str | None = None, deleted: bool | None = None)[исходный код]

Базовые классы: BaseModel

Статус заказа.

city: str | None
city_uuid: str | None
code: str | None
date_time: datetime | None
deleted: bool | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str | None
reason_code: str | None
serialize_date_time(date_time: datetime) str[исходный код]

Вернуть время установки статуса в формате ISO 8601

class cdek.apps.models.order.RescheduledCall(*, date_time: datetime, date_next: date, time_next: str, comment: str | None = None)[исходный код]

Базовые классы: BaseModel

comment: str | None
date_next: Date
date_time: datetime
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

serialize_date_next(date_next: date) str[исходный код]

Вернуть дату следующего прозвона в формате YYYY-MM-DD

serialize_date_time(date_time: datetime) str[исходный код]

Представить дату создания переноса прозвона в формате ISO 8601

time_next: str
class cdek.apps.models.order.UpdateOrder(*, type: int | None = None, number: str | None = None, accompanying_number: str | None = None, tariff_code: int | None = None, comment: str | None = None, shipment_point: str | None = None, delivery_point: str | None = None, delivery_recipient_cost: DeliveryRecipientCost | None = None, delivery_recipient_cost_adv: list[DeliveryCostThreshold] | None = None, sender: Contact | None = None, seller: Seller | None = None, recipient: Contact, from_location: OrderLocation | None = None, to_location: OrderLocation | None = None, services: list[AdditionalService] | None = None, packages: list[Package] | None = None, has_reverse_order: bool | None = None)[исходный код]

Базовые классы: BaseModel

accompanying_number: str | None
comment: str | None
classmethod contact_init(**kwargs: Any) Contact[исходный код]

Создать объект контакта отправителя или получателя

delivery_point: str | None
delivery_recipient_cost: DeliveryRecipientCost | None
delivery_recipient_cost_adv: list[DeliveryCostThreshold] | None
from_location: OrderLocation | None
has_reverse_order: bool | None
classmethod location_init(**kwargs: Any) OrderLocation[исходный код]

Создать объект адреса заказа с указанными полями

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

number: str | None
classmethod package_init(**kwargs: Any) Package[исходный код]

Создать объект упаковки по переданным параметрам

packages: list[Package] | None
recipient: Contact
seller: Seller | None
classmethod seller_init(**kwargs: Any) Seller[исходный код]

Создать объект продавца по переданным параметрам

sender: Contact | None
services: list[AdditionalService] | None
set_contact(sender: Contact) Order[исходный код]

Сохранить контактные данные отправителя

set_delivery_point(code: str) Order[исходный код]

Задать код ПВЗ СДЭК

set_from_location(location: OrderLocation) Order[исходный код]

Задать адрес отправления

set_recipient(recipient: Contact) Order[исходный код]

Сохранить контактные данные получателя

set_seller(seller: Seller) Order[исходный код]

Установить продавца для текущего заказа

set_shipment_point(code: str) Order[исходный код]

Задать код ПВЗ СДЭК

set_to_location(location: OrderLocation) Order[исходный код]

Задать адрес доставки

shipment_point: str | None
tariff_code: int | None
to_location: OrderLocation | None
type: int | None

cdek.apps.models.package module

class cdek.apps.models.package.CalcPackage(*, weight: int | None = None, length: int | None = None, width: int | None = None, height: int | None = None)[исходный код]

Базовые классы: BaseModel

height: int | None
length: int | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

weight: int | None
width: int | None
class cdek.apps.models.package.Package(*, weight: int, length: int | None = None, width: int | None = None, height: int | None = None, number: str, comment: str | None = None, items: list[Item] | None = None, package_id: str | None = None)[исходный код]

Базовые классы: CalcPackage

add_item(**kwargs: Any) Item[исходный код]

Добавить товар в упаковку и вернуть созданный объект

comment: str | None
height: int | None
items: list[Item] | None
length: int | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

number: str
package_id: str | None
weight: int
width: int | None

cdek.apps.models.payment_info module

class cdek.apps.models.payment_info.PaymentInfo(*, sum: float, type: Literal['CASH', 'CARD'])[исходный код]

Базовые классы: BaseModel

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

sum: float
type: Literal['CASH', 'CARD']

cdek.apps.models.phone module

Модель для работы с телефоном.

class cdek.apps.models.phone.Phone(*, number: Annotated[str, MaxLen(max_length=24)], additional: Annotated[str | None, MaxLen(max_length=255)] = None)[исходный код]

Базовые классы: BaseModel

Модель для телефонного номера.

additional: str | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

number: str

cdek.apps.models.print module

class cdek.apps.models.print.PrintForm(*, orders: list[PrintOrder], copy_count: int | None = None)[исходный код]

Базовые классы: BaseModel

copy_count: int | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

orders: list[PrintOrder]
class cdek.apps.models.print.PrintOrder(*, order_uuid: str | None = None, cdek_number: int | None = None)[исходный код]

Базовые классы: BaseModel

cdek_number: int | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

order_uuid: str | None
class cdek.apps.models.print.PrintType(*values)[исходный код]

Базовые классы: str, Enum

Типы печатной формы

tpl_armenia = 'tpl_armenia'
tpl_china = 'tpl_china'
tpl_czech = 'tpl_czech'
tpl_english = 'tpl_english'
tpl_german = 'tpl_german'
tpl_invoice = 'tpl_invoice'
tpl_italian = 'tpl_italian'
tpl_korean = 'tpl_korean'
tpl_latvian = 'tpl_latvian'
tpl_lithuanian = 'tpl_lithuanian'
tpl_russia = 'tpl_russia'
tpl_thailand = 'tpl_thailand'
tpl_turkish = 'tpl_turkish'

cdek.apps.models.related_entity module

class cdek.apps.models.related_entity.RelatedEntity(*, uuid: UUID | None = None, type: RelatedEntityType, url: Annotated[str | None, MaxLen(max_length=255)] = None, create_time: datetime | None = None, cdek_number: Annotated[str | None, MaxLen(max_length=255)] = None, date: date | None = None, time_from: str | None = None, time_to: str | None = None)[исходный код]

Базовые классы: BaseModel

Связанные сущности

cdek_number: str | None
classmethod convert_type_to_upper(v: str) str[исходный код]

Преобразование типа в верхний регистр перед валидацией

create_time: datetime | None
date: Date | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

serialize_create_time(create_time: datetime) str[исходный код]

Конвертировать время создания в строку ISO

serialize_date(date: date) str[исходный код]

Конвертировать дату доставки в формат YYYY-MM-DD

time_from: str | None
time_to: str | None
type: RelatedEntityType
url: str | None
uuid: UUID | None
class cdek.apps.models.related_entity.RelatedEntityType(*values)[исходный код]

Базовые классы: str, Enum

Типы связанных сущностей

BARCODE = 'BARCODE'
CLIENT_DIRECT_ORDER = 'CLIENT_DIRECT_ORDER'
CLIENT_RETURN_ORDER = 'CLIENT_RETURN_ORDER'
DELIVERY = 'DELIVERY'
DIRECT_ORDER = 'DIRECT_ORDER'
RETURN_ORDER = 'RETURN_ORDER'
REVERSE_ORDER = 'REVERSE_ORDER'
WAYBILL = 'WAYBILL'

cdek.apps.models.request module

class cdek.apps.models.request.Request(*, request_uuid: UUID | None = None, type: Literal['CREATE', 'UPDATE', 'DELETE', 'AUTH', 'GET', 'CREATE_CLIENT_RETURN', 'CREATE_REFUSAL'], date_time: datetime, state: Annotated[Literal['ACCEPTED', 'WAITING', 'SUCCESSFUL', 'INVALID'], MaxLen(max_length=255)], errors: list[Error] | None = None, warnings: list[WarningModel] | None = None)[исходный код]

Базовые классы: BaseModel

Модель ответа о запросе.

date_time: datetime
errors: list[Error] | None
get_state() str | None[исходный код]

Получить состояние запроса.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

request_uuid: UUID | None
serialize_date_time(date_time: datetime) str[исходный код]

Представить дату последнего изменения запроса в формате ISO

state: Literal['ACCEPTED', 'WAITING', 'SUCCESSFUL', 'INVALID']
type: Literal['CREATE', 'UPDATE', 'DELETE', 'AUTH', 'GET', 'CREATE_CLIENT_RETURN', 'CREATE_REFUSAL']
warnings: list[WarningModel] | None

cdek.apps.models.seller module

class cdek.apps.models.seller.Seller(*, name: str | None = None, inn: str | None = None, phone: str | None = None, ownership_form: int | None = None, address: str | None = None)[исходный код]

Базовые классы: BaseModel

Модель для реквизитов истинного продавца

address: str | None
inn: str | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str | None
ownership_form: int | None
phone: str | None

cdek.apps.models.status module

class cdek.apps.models.status.Status(*, code: str, name: str, date_time: datetime)[исходный код]

Базовые классы: BaseModel

code: str
date_time: datetime
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str
serialize_date_time(date_time: datetime) str[исходный код]

Преобразовать дату статуса в строку формата ISO

cdek.apps.models.warning module

class cdek.apps.models.warning.WarningModel(*, code: str | None = None, message: str | None = None)[исходный код]

Базовые классы: BaseModel

Предупреждения

code: str | None
message: str | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

cdek.apps.models.work_time module

class cdek.apps.models.work_time.WorkTime(*, day: int, time: Annotated[str, MaxLen(max_length=255)])[исходный код]

Базовые классы: BaseModel

day: int
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

time: str
class cdek.apps.models.work_time.WorkTimeException(*, date_start: date, date_end: date, time_start: str | None = None, time_end: str | None = None, is_working: bool)[исходный код]

Базовые классы: BaseModel

date_end: Date
date_start: Date
is_working: bool
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

serialize_date_end(date_end: date) str[исходный код]

Представить дату окончания исключения в формате ISO

serialize_date_start(date_start: date) str[исходный код]

Представить дату начала исключения в формате ISO

time_end: str | None
time_start: str | None