cdek.apps.agreement package¶
- class cdek.apps.agreement.AgreementApp(client: CdekClient)[исходный код]¶
Базовые классы:
AppКласс для работы с договоренностями о доставке
- create(agreement: RegisterDeliveryRequest) EntityResponse[исходный код]¶
Регистрация договоренности о доставке
- Args:
- agreement (RegisterDeliveryRequest): объект с информацией
о договоренности о доставке
- Returns:
EntityResponse: объект с информацией о регистрации договоренности о доставке
- Raises:
ValueError: если agreement не является объектом RegisterDeliveryRequest
- get(uuid: str) AgreementInfoResponse[исходный код]¶
Получение договоренностей для курьера
- Args:
uuid (str): UUID договора
- Returns:
AgreementInfoResponse: объект с информацией о договорах
- get_interval_number(cdek_number: str) AvailableDeliveryIntervalsResponse[исходный код]¶
Получить интервалы доставки по номеру заказа
- Args:
cdek_number (str): номер заказа
- Returns:
AvailableDeliveryIntervalsResponse: объект с информацией о интервалах доставки
- get_interval_uuid(uuid: str) AvailableDeliveryIntervalsResponse[исходный код]¶
Получение интервалов доставки по UUID заказа
- Args:
uuid (str): UUID заказа
- Returns:
AvailableDeliveryIntervalsResponse: объект с информацией о интервалах доставки
- get_intervals_before_create_order(request: DeliveryIntervalRequest) AvailableDeliveryIntervalsResponse[исходный код]¶
Получение интервалов доставки до создания заказа
- Args:
request (DeliveryIntervalRequest): объект с информацией о запросе на получение интервалов доставки до создания заказа
- Returns:
- AvailableDeliveryIntervalsResponse: объект с информацией о интервалах
доставки до создания заказа
- Raises:
ValueError: если request не является объектом DeliveryIntervalRequest
- class cdek.apps.agreement.AgreementInfoResponse(*, entity: ScheduleInfoEntity | None = None)[исходный код]¶
Базовые классы:
BaseModel- entity: ScheduleInfoEntity | None¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class cdek.apps.agreement.AvailableDeliveryInterval(*, start_time: str, end_time: str)[исходный код]¶
Базовые классы:
BaseModel- end_time: str¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- start_time: str¶
- class cdek.apps.agreement.AvailableDeliveryIntervalsInfo(*, date: date, time_intervals: list[AvailableDeliveryInterval])[исходный код]¶
Базовые классы:
BaseModel- date: Date¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- serialize_date(date: date) str[исходный код]¶
Представить дату интервала доставки в формате YYYY-MM-DD
- time_intervals: list[AvailableDeliveryInterval]¶
- class cdek.apps.agreement.AvailableDeliveryIntervalsResponse(*, date_intervals: list[AvailableDeliveryIntervalsInfo])[исходный код]¶
Базовые классы:
BaseModel- date_intervals: list[AvailableDeliveryIntervalsInfo]¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class cdek.apps.agreement.DeliveryIntervalRequest(*, date_time: datetime, from_location: DeliveryLocation | None = None, shipment_point: str | None = None, to_location: DeliveryLocation, tariff_code: int, additional_order_types: list[int] | None = None)[исходный код]¶
Базовые классы:
BaseModel- additional_order_types: list[int] | None¶
- date_time: datetime¶
- from_location: DeliveryLocation | None¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- serialize_date_time(date_time: datetime) str[исходный код]¶
Вернуть дату запроса интервалов в формате ISO 8601
- shipment_point: str | None¶
- tariff_code: int¶
- to_location: DeliveryLocation¶
- class cdek.apps.agreement.DeliveryLocation(*, 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, longitude: float | None = None, latitude: float | None = None, postal_code: str | None = None, code: int | None = None, fias_guid: UUID | None = None, city: str | None = None, address: str)[исходный код]¶
Базовые классы:
Zip,Coordinates,Country,Region- address: str¶
- city: str | None¶
- code: int | None¶
- 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.agreement.RegisterDeliveryRequest(*, cdek_number: int | None = None, order_uuid: str | None = None, date: date, time_from: str, time_to: str, comment: Annotated[str | None, MaxLen(max_length=255)] = None, delivery_point: Annotated[str | None, MaxLen(max_length=255)] = None, to_location: ScheduleLocation | None = None)[исходный код]¶
Базовые классы:
OrderInfo- comment: str | None¶
- date: Date¶
- delivery_point: str | None¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- serialize_date(date: date) str[исходный код]¶
Вернуть дату доставки в формате YYYY-MM-DD
- set_to_location(location: ScheduleLocation) RegisterDeliveryRequest[исходный код]¶
Установить локацию доставки
- time_from: str¶
- time_to: str¶
- to_location: ScheduleLocation | None¶
- to_location_init(**kwargs: Any) ScheduleLocation[исходный код]¶
Создать объект локации для договорённости о доставке
- class cdek.apps.agreement.ScheduleInfoEntity(*, cdek_number: int | None = None, order_uuid: str | None = None, date: date, time_from: str, time_to: str, comment: Annotated[str | None, MaxLen(max_length=255)] = None, delivery_point: Annotated[str | None, MaxLen(max_length=255)] = None, to_location: ScheduleLocation | None = None, uuid: UUID, statuses: list[Status], source: str | None = None)[исходный код]¶
Базовые классы:
RegisterDeliveryRequest- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- source: str | None¶
- uuid: UUID¶
- class cdek.apps.agreement.ScheduleLocation(*, postal_code: str | None = None, address: str | None = None, address_full: 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: str | None = None, city: str | None = None, fias_guid: UUID | None = None)[исходный код]¶
Базовые классы:
City,Country,Region,Coordinates,Address,Zip- city: str | None¶
- city_uuid: str | 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¶
- region_code: int | None¶
Submodules¶
cdek.apps.agreement.agreement module¶
- class cdek.apps.agreement.agreement.AgreementApp(client: CdekClient)[исходный код]¶
Базовые классы:
AppКласс для работы с договоренностями о доставке
- create(agreement: RegisterDeliveryRequest) EntityResponse[исходный код]¶
Регистрация договоренности о доставке
- Args:
- agreement (RegisterDeliveryRequest): объект с информацией
о договоренности о доставке
- Returns:
EntityResponse: объект с информацией о регистрации договоренности о доставке
- Raises:
ValueError: если agreement не является объектом RegisterDeliveryRequest
- get(uuid: str) AgreementInfoResponse[исходный код]¶
Получение договоренностей для курьера
- Args:
uuid (str): UUID договора
- Returns:
AgreementInfoResponse: объект с информацией о договорах
- get_interval_number(cdek_number: str) AvailableDeliveryIntervalsResponse[исходный код]¶
Получить интервалы доставки по номеру заказа
- Args:
cdek_number (str): номер заказа
- Returns:
AvailableDeliveryIntervalsResponse: объект с информацией о интервалах доставки
- get_interval_uuid(uuid: str) AvailableDeliveryIntervalsResponse[исходный код]¶
Получение интервалов доставки по UUID заказа
- Args:
uuid (str): UUID заказа
- Returns:
AvailableDeliveryIntervalsResponse: объект с информацией о интервалах доставки
- get_intervals_before_create_order(request: DeliveryIntervalRequest) AvailableDeliveryIntervalsResponse[исходный код]¶
Получение интервалов доставки до создания заказа
- Args:
request (DeliveryIntervalRequest): объект с информацией о запросе на получение интервалов доставки до создания заказа
- Returns:
- AvailableDeliveryIntervalsResponse: объект с информацией о интервалах
доставки до создания заказа
- Raises:
ValueError: если request не является объектом DeliveryIntervalRequest
cdek.apps.agreement.requests module¶
- class cdek.apps.agreement.requests.DeliveryIntervalRequest(*, date_time: datetime, from_location: DeliveryLocation | None = None, shipment_point: str | None = None, to_location: DeliveryLocation, tariff_code: int, additional_order_types: list[int] | None = None)[исходный код]¶
Базовые классы:
BaseModel- additional_order_types: list[int] | None¶
- date_time: datetime¶
- from_location: DeliveryLocation | None¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- serialize_date_time(date_time: datetime) str[исходный код]¶
Вернуть дату запроса интервалов в формате ISO 8601
- shipment_point: str | None¶
- tariff_code: int¶
- to_location: DeliveryLocation¶
- class cdek.apps.agreement.requests.DeliveryLocation(*, 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, longitude: float | None = None, latitude: float | None = None, postal_code: str | None = None, code: int | None = None, fias_guid: UUID | None = None, city: str | None = None, address: str)[исходный код]¶
Базовые классы:
Zip,Coordinates,Country,Region- address: str¶
- city: str | 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¶
- region_code: int | None¶
- sub_region: str | None¶
- class cdek.apps.agreement.requests.RegisterDeliveryRequest(*, cdek_number: int | None = None, order_uuid: str | None = None, date: date, time_from: str, time_to: str, comment: Annotated[str | None, MaxLen(max_length=255)] = None, delivery_point: Annotated[str | None, MaxLen(max_length=255)] = None, to_location: ScheduleLocation | None = None)[исходный код]¶
Базовые классы:
OrderInfo- cdek_number: int | None¶
- comment: str | None¶
- date: Date¶
- delivery_point: str | None¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- order_uuid: str | None¶
- serialize_date(date: date) str[исходный код]¶
Вернуть дату доставки в формате YYYY-MM-DD
- set_to_location(location: ScheduleLocation) RegisterDeliveryRequest[исходный код]¶
Установить локацию доставки
- time_from: str¶
- time_to: str¶
- to_location: ScheduleLocation | None¶
- to_location_init(**kwargs: Any) ScheduleLocation[исходный код]¶
Создать объект локации для договорённости о доставке
- class cdek.apps.agreement.requests.ScheduleLocation(*, postal_code: str | None = None, address: str | None = None, address_full: 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: str | None = None, city: str | None = None, fias_guid: UUID | None = None)[исходный код]¶
Базовые классы:
City,Country,Region,Coordinates,Address,Zip- address: str | None¶
- address_full: str | None¶
- city: str | None¶
- city_uuid: str | 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¶
cdek.apps.agreement.responses module¶
- class cdek.apps.agreement.responses.AgreementInfoResponse(*, entity: ScheduleInfoEntity | None = None)[исходный код]¶
Базовые классы:
BaseModel- entity: ScheduleInfoEntity | None¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class cdek.apps.agreement.responses.AvailableDeliveryInterval(*, start_time: str, end_time: str)[исходный код]¶
Базовые классы:
BaseModel- end_time: str¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- start_time: str¶
- class cdek.apps.agreement.responses.AvailableDeliveryIntervalsInfo(*, date: date, time_intervals: list[AvailableDeliveryInterval])[исходный код]¶
Базовые классы:
BaseModel- date: Date¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- serialize_date(date: date) str[исходный код]¶
Представить дату интервала доставки в формате YYYY-MM-DD
- time_intervals: list[AvailableDeliveryInterval]¶
- class cdek.apps.agreement.responses.AvailableDeliveryIntervalsResponse(*, date_intervals: list[AvailableDeliveryIntervalsInfo])[исходный код]¶
Базовые классы:
BaseModel- date_intervals: list[AvailableDeliveryIntervalsInfo]¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class cdek.apps.agreement.responses.ScheduleInfoEntity(*, cdek_number: int | None = None, order_uuid: str | None = None, date: date, time_from: str, time_to: str, comment: Annotated[str | None, MaxLen(max_length=255)] = None, delivery_point: Annotated[str | None, MaxLen(max_length=255)] = None, to_location: ScheduleLocation | None = None, uuid: UUID, statuses: list[Status], source: str | None = None)[исходный код]¶
Базовые классы:
RegisterDeliveryRequest- cdek_number: int | None¶
- comment: str | None¶
- date: Date¶
- delivery_point: str | None¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- order_uuid: str | None¶
- source: str | None¶
- time_from: str¶
- time_to: str¶
- to_location: ScheduleLocation | None¶
- uuid: UUID¶