Skip to main content

Библиотека для работы с API Почты России

Project description

fs-pochta-api

PyPI Version

Описание

Библиотека для работы с API Почты России.

Установка

Для работы требуется Python 3.6+ Для установки используйте pipenv (или pip):

$ pipenv install fs-pochta-api
$ pip install fs-pochta-api

Реализованные методы API

  1. Трекинг (Модуль pochta.tracking)
    • Единичный доступ
    • Пакетный доступ
  2. Доставка (Модуль 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.1.tar.gz (9.4 kB view hashes)

Uploaded Source

Built Distribution

fs_pochta_api-0.2.1-py3-none-any.whl (9.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page