Skip to main content

postprice

Библиотека Python для расчета стоимости почтовых отправлений Почтой России.

Бибиотека использует API ресурса postprice.ru.

Версия Python

Версия, на которой велась разработка - 3.8, но функционал должен работать для любой версии Python 3.

Installation

pip install postprice

Usage examples

from postprice import PostPrice
json = PostPrice().calculate(index_from='630000', index_to='620000', mass=40, valuation=500, vat=True)

Другой вариант вызова:

post = PostPrice(index_from='630000', valuation=500, vat=True)
json = post.calculate(index_to='620000', mass=40)

Пример json-ответа:

{
    'code': 100, 
    'locality_from': 'НОВОСИБИРСК ПОЧТАМТ', 
    'locality_to': 'ЕКАТЕРИНБУРГ', 
    'city_from': 'НОВОСИБИРСК', 
    'city_to': 'ЕКАТЕРИНБУРГ', 
    'region_from': 'НОВОСИБИРСКАЯ ОБЛАСТЬ', 
    'region_to': 'СВЕРДЛОВСКАЯ ОБЛАСТЬ', 
    'simple_letter': 31.2, 
    'reg_letter': 68.4, 
    'val_letter': 159.2, 
    'simple_parcel': 48, 
    'reg_parcel': 84, 
    'val_parcel': 164, 
    'pkg': 284.34, 
    'ems': 727.52, 
    'letter_reg_1class': 144, 
    'letter_val_1class': 228, 
    'reg_parcel1class': 186, 
    'val_parcel1class': 252, 
    'pkg_1class': 179, 
    'pkg_val_1class': 283, 
    'cod': 605
}

Описание параметров

from - Почтовый индекс отправителя (6 цифр).
to - Почтовый индекс получателя (6 цифр). index_from - alias для from.
index_to - alias для to.
mass - Масса отправления, в граммах (значения от 0 до 20000).
valuation - Объявленная ценность, в рублях.
vat - НДС 20% (1 — с НДС, 0 — без НДС). Возможна подача boolean.
oversized - Негабаритная посылка (1 — негабаритная, 0 — обычная). Возможна подача boolean.
month - Месяц отправки (от 1 до 12).
day - День месяца отправки (от 1 до 31).
date - Дата типа datetime.datetime (или datetime.date), подается вместо month и date.

Обязательные параметры запроса: from, to.

Changelog

1.0.0 (2020-10-07)

  • Первая рабочая версия

Теги

Почта России, доставка, почта, письмо, посылка, pochta.ru, russian post, russianpost

Metadata

Release files for postprice 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for postprice 1.0.0
File Size Uploaded Provenance Actions
postprice-1.0.0.tar.gz 4.0 kB Without provenance Details for postprice-1.0.0.tar.gz

Release files / postprice-1.0.0.tar.gz

Download URL postprice-1.0.0.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ec0601fdf0267df0bbb79fc1d5fa4e087562bcbe7d874262bb9da85b2a1cc7ba
BLAKE2b-256 checksum
How to use checksums
78f1c34d5021ef4c18555de7f01fbb5bd6407c0d0af2d6f820eca7fe7b7618f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.1 CPython/3.8.0

Security for postprice 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page