Библиотека для работы с API Почты России
Project description
fs-pochta-api
Описание
Библиотека для работы с API Почты России.
Установка
Для работы требуется Python 3.6+ Для установки используйте pipenv (или pip):
$ pipenv install fs-pochta-api
$ pip install fs-pochta-api
Реализованные методы API
- Трекинг (Модуль
pochta.tracking
)- Единичный доступ
- Пакетный доступ
- Доставка (Модуль
pochta.delivery
)- Заказы
- Партии
- Документы
- Архив
- Поиск ОПС
- Долгосрочное хранение
- Настройки
- Данные
Примеры
Трекинг
Получение истории отправления
tracker = Tracking('login', 'pass')
history = tracker.get_history('barcode')
Доставка
Инициализация клиента
delivery = Delivery('email', 'password','access_token')
Расчет стоимости доставки
calc_result = delivery.calc_delivery(
index_from='680000', # Индексы ОПС указанные в ЛК
index_to='644015',
mail_category=MailCategory.ORDINARY,
mail_type=MailType.POSTAL_PARCEL,
mass=1000,
height=2,
length=5,
width=197,
fragile=True
)
Нормализация адреса
result = delivery.clean_address([
Address("Москва, Варшавское шоссе, 37"),
Address("ул. Мясницкая, д. 26, г. Москва, 1")
])
Получение баланса
print(delivery.balance)
Нормализация ФИО
print(delivery.clean_physical([Name('Иван Иванов Иванович')]))
Нормализация телефона
print(delivery.clean_phone([Phone('+79999999999')]))
Неблагонадёжный получатель
recipient = Recipient(
address='Москва, ул. Пушкина 1, 1',
full_name='Иванов Иван Иванович',
phone='+79999999999',
)
print(delivery.check_unreliable_recipient([recipient]))
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
fs-pochta-api-0.2.0.tar.gz
(9.3 kB
view hashes)
Built Distribution
Close
Hashes for fs_pochta_api-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67bebb4f1021b608ac567e35ebbd8661bae2194c176ce949f0bc40b4d0eb914b |
|
MD5 | d1471a3e27f912a96d1208703c91e1a1 |
|
BLAKE2b-256 | 1be073691dc4a0ce95959fdcc4d566dfc6b56b66c7e57ab0f9303e50356002e9 |