ΠΡΠΎΡΡΠΎΠΉ ΡΠΏΠΎΡΠΎΠ± ΠΎΠ±ΡΠ°ΡΡΡΡ Ρ ΡΠΎΡΡΠΈΠΉΡΠΊΠΈΠΌΠΈ ΠΌΠ°ΡΠΊΠ΅ΡΠΏΠ»Π΅ΠΉΡΠ°ΠΌΠΈ!
- ΠΠΎΠ»Π½ΠΎΡΡΡΡ Π°ΡΠΈΠ½Ρ ΡΠΎΠ½Π½Π°Ρ Π±ΠΈΠ±Π»ΠΈΠΎΡΠ΅ΠΊΠ°
- ΠΡΠΎΡΡΠ°Ρ ΠΈ ΠΏΠΎΠ½ΡΡΠ½Π°Ρ Π² ΠΈΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°Π½ΠΈΠΈ
- ΠΠΎΠ΄Π΄Π΅ΡΠΆΠΈΠ²Π°Π΅Ρ Ozon SellerAPI ΠΈ Yandex MarketAPI - ΠΏΠΎΠ΄Π΄Π΅ΡΠΆΠΊΠ° Wildberries API soonβ’
- ΠΡΠΏΠΎΠ»ΡΠ·ΡΠ΅Ρ httpx ΠΈ mashumaro ΠΏΠΎΠ΄ ΠΊΠ°ΠΏΠΎΡΠΎΠΌ
ΠΠΎΠ΄ΡΠΎΠ±Π½Π°Ρ Π΄ΠΎΠΊΡΠΌΠ΅Π½ΡΠ°ΡΠΈΡ ΠΏΠΎ ΡΡΡΠ»ΠΊΠ΅ https://packify-org.github.io/marketplace_apis/
import asyncio
from datetime import datetime, timedelta
from marketplace_apis.ozon.seller_api import SellerApi
import os
async def main():
async with SellerApi(os.getenv("API_KEY"), os.getenv("CLIENT_ID")) as client:
# ΠΏΠΎΠ»ΡΡΠΈΡΡ Π²ΡΠ΅ ΠΎΡΠΏΡΠ°Π²Π»Π΅Π½ΠΈΡ Π·Π° ΠΏΡΠΎΡΠ΅Π΄ΡΠΈΠ΅ 14 Π΄Π½Π΅ΠΉ
now = datetime.now()
postings = await client.posting.list_postings(
filter_since=now - timedelta(14),
filter_to=now)
print(postings)
# ΠΏΠΎΠ»ΡΡΠΈΡΡ ΠΈΠ½ΡΠΎΡΠΌΠ°ΡΠΈΡ ΠΈ ΡΠΎΠ²Π°ΡΠ°Ρ
Π² ΠΏΠ΅ΡΠ²ΠΎΠΌ ΠΎΡΠΏΡΠ°Π²Π»Π΅Π½ΠΈΠΈ
async with asyncio.TaskGroup() as tg:
posting = postings[0]
offer_ids = [product.offer_id for product in posting.products]
info = tg.create_task(client.product.list_info(offer_ids))
attributes = tg.create_task(
client.product.list_attributes(offer_id=offer_ids))
print(info.result(), attributes.result())
asyncio.run(main())
import asyncio
from datetime import datetime, timedelta
from marketplace_apis.yandex.market_api import MarketApi
import os
async def main():
# Π½Π΅ Π½ΡΠΆΠ½ΠΎ ΠΏΠ΅ΡΠ΅Π΄Π°Π²Π°ΡΡ CAMPAIGN_ID ΠΈΠ»ΠΈ BUSINESS_ID,
# Π΅ΡΠ»ΠΈ Π²Ρ Π½Π΅ Π±ΡΠ΄Π΅ΡΠ΅ ΠΈΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°ΡΡ ΠΌΠ΅ΡΠΎΠ΄Ρ, ΠΊΠΎΡΠΎΡΡΠΌ ΠΎΠ½ΠΈ Π½ΡΠΆΠ½Ρ
async with MarketApi(os.getenv("TOKEN"), os.getenv("CAMPAIGN_ID"),
os.getenv("BUSINESS_ID")) as client:
# ΠΏΠΎΠ»ΡΡΠΈΡΡ Π²ΡΠ΅ ΠΎΡΠΏΡΠ°Π²Π»Π΅Π½ΠΈΡ Π·Π° ΠΏΡΠΎΡΠ΅Π΄ΡΠΈΠ΅ 14 Π΄Π½Π΅ΠΉ
now = datetime.now()
orders = await client.order.list_orders(
fromDate=(now - timedelta(14)).date(),
toDate=now.date())
print(orders)
# ΠΏΠΎΠ»ΡΡΠΈΡΡ offer_mappings ΠΈΠ· ΠΏΠ΅ΡΠ²ΠΎΠ³ΠΎ ΠΎΡΠΏΡΠ°Π²Π»Π΅Π½ΠΈΡ
order = orders[0]
offer_ids = [item.offerId for item in order.items]
offer_mappings = await client.offer_mapping.list_offer_mappings(
offerIds=offer_ids)
print(offer_mappings)
asyncio.run(main())