Metadata-Version: 2.1
Name: fs-pochta-api
Version: 0.2.1
Summary: Библиотека для работы с API Почты России
Home-page: https://github.com/fogstream/fs-pochta-api
Maintainer: fadedDexofan
Maintainer-email: fadeddexofan@gmail.com
License: MIT
Keywords: pochta,api,wrapper,fs-pochta-api,sdk,integration,fogstream,lib
Platform: UNKNOWN
Classifier: License :: OSI Approved :: MIT License
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Operating System :: Unix
Classifier: Topic :: Software Development :: Libraries
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: Implementation :: CPython
Requires-Python: >=3.6.0
Description-Content-Type: text/markdown
Requires-Dist: requests
Requires-Dist: boltons
Requires-Dist: zeep
Provides-Extra: dev
Requires-Dist: isort ; extra == 'dev'
Requires-Dist: flake8 ; extra == 'dev'
Requires-Dist: pylint ; extra == 'dev'


fs-pochta-api
==========

[![PyPI Version](https://img.shields.io/pypi/v/fs-pochta-api.svg)](https://pypi.python.org/pypi/fs-pochta-api)

Описание
------------
Библиотека для работы с API [Почты России](https://www.pochta.ru/support/business/api).

Установка
------------
Для работы требуется Python 3.6+
Для установки используйте [pipenv](http://pipenv.org/) (или pip):

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

Реализованные методы API
-----------
1. Трекинг (Модуль `pochta.tracking`)
    * [x] Единичный доступ
    * [ ] Пакетный доступ 
2. Доставка (Модуль `pochta.delivery`)
    * [ ] Заказы
    * [ ] Партии
    * [ ] Документы
    * [ ] Архив
    * [ ] Поиск ОПС
    * [ ] Долгосрочное хранение
    * [ ] Настройки
    * [x] Данные

Примеры
-------------
### Трекинг
Получение истории отправления
```python
tracker = Tracking('login', 'pass')
history = tracker.get_history('barcode')
```

### Доставка
#### Инициализация клиента
```python
delivery = Delivery('email', 'password','access_token')
```

#### Расчет стоимости доставки
```python
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
)
```

#### Нормализация адреса
```python
result = delivery.clean_address([
    Address("Москва, Варшавское шоссе, 37"),
    Address("ул. Мясницкая, д. 26, г. Москва, 1")
])
```

#### Получение баланса
```python
print(delivery.balance)
```

#### Нормализация ФИО
```python
print(delivery.clean_physical([Name('Иван Иванов Иванович')]))
```

#### Нормализация телефона
```python
print(delivery.clean_phone([Phone('+79999999999')]))
```

#### Неблагонадёжный получатель
```python
recipient = Recipient(
    address='Москва, ул. Пушкина 1, 1', 
    full_name='Иванов Иван Иванович', 
    phone='+79999999999',
)
print(delivery.check_unreliable_recipient([recipient]))
```

