Skip to main content

AioAbcpApi

Асинхронная библиотека для API ABCP с asyncio и aiohttp

Supported python versions Downloads PyPi Package Version

Присоединяйтесь к телеграм чату

Установка

pip install aioabcpapi

Описание


Все методы максимально приближены к древовидному оформлению официальной документации.

Разделяются на cp и ts, они в свою очередь разделяются на client и admin, далее для поиска нужного вам метода отталкивайтесь от документации API ABCP.

Для примера, из документации TS.Client, Обновление позиции в корзине описание операции следующее:

Операция: POST /ts/cart/update

Для использования этого метода нам нужно будет обратиться к await api.ts.client.cart.update()

Доступ к API


Для API Администратора

Если вы являетесь клиентом магазина на платформе ABCP, обратитесь к вашему менеджеру. (Вам понадобится статический IP адрес)

Примечание


Все аргументы времени, такие как create_time, update_time, date_start, date_end и прочие, принимают str или datetime. При передаче datetime объект будет преобразован в зависимости от требований метода в RFC3339 или "%Y-%m-%d %H:%M:%S"

Пример


import asyncio
from aioabcpapi import Abcp

host, login, password = 'id33333', 'api@id33333', 'md5hash'
api = Abcp(host, login, password)


async def search_some_parts(article, brand):
    search_result = await api.cp.client.search.articles(number=article, brand=brand,
                                                        use_online_stocks=True,
                                                        disable_online_filtering=True,
                                                        with_out_analogs=True)
    for x in search_result:
        if float(x['price']) < 3000:
            print('Похоже на чудо, но скорее ошибка прайса. Отключим пока поставщика')
            await api.cp.admin.distributors.edit_status(x['distributorId'], False)
        elif float(x['price']) < 37000:
            await api.cp.client.basket.add(basket_positions={'number': x['article'],
                                                             'brand': x['brand'],
                                                             'supplierCode': x['supplierCode'],
                                                             'itemKey': x['itemKey'],
                                                             'quantity': 1,
                                                             'comment': f"Да, РРЦ никто не любит"})


if __name__ == '__main__':
    asyncio.run(search_some_parts('602000600', 'LuK'))

Больше примеров

Release files for aioabcpapi 2.2.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 aioabcpapi 2.2.0
File Size Uploaded
aioabcpapi-2.2.0.tar.gz 69.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aioabcpapi 2.2.0
File Interpreter ABI Platform
aioabcpapi-2.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 142.0 kB

Release files / aioabcpapi-2.2.0.tar.gz

Download URL aioabcpapi-2.2.0.tar.gz
Size 69.0 kB
Tags Source
SHA-256 checksum
How to use checksums
04de65ace026c0ed0fbf7690277ea86e723c39a56174d35704fe05be34a01cfb
BLAKE2b-256 checksum
How to use checksums
926525825b7c95f0e4fbe3ffce40560a02abf684606d6c766e8e93ce0c25fdb4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / aioabcpapi-2.2.0-py3-none-any.whl

Download URL aioabcpapi-2.2.0-py3-none-any.whl
Size 73.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
039328db6952b4a9cc486f48ab1d694b75c994bca4f280e9ca9986d70e6686ed
BLAKE2b-256 checksum
How to use checksums
31140841139f78b1c02680079eee14475f40ca76c3da7ea20a8b116f0c151055
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release history Release notifications | RSS feed

This release

2.2.0 This release

2 release files

2.1.2

2 release files

2.1.1

2 release files

2.0.9

2 release files

2.0.8

2 release files

2.0.7

2 release files

2.0.6

1 release file

2.0.5

1 release file

2.0.4

1 release file

2.0.3

1 release file

2.0.2

1 release file

2.0.1

1 release file

2.0.0

1 release file

1.1.5

1 release file

1.1.4

1 release file

1.1.3

1 release file

1.1.2

1 release file

1.1.1

1 release file

1.1.0

1 release file

1.0.6

1 release file

1.0.5

1 release file

1.0.4

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

1 release file

0.5.2

1 release file

0.5.1

1 release file

0.5.0

1 release file

0.4.2

1 release file

0.4.1

1 release file

0.4

1 release file

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