python-aliexpress-api icon indicating copy to clipboard operation
python-aliexpress-api copied to clipboard

Aliexpress affiliate product shipping info get request

Open iu2frl opened this issue 9 months ago • 0 comments

This is a one-shot implementation of #38 and #39. I added the API to retrieve the shipping details and corrected a typo in the RestApi routine. The old name was kept using the as clause of Python to ensure backward compatibility

Test code:

from aliexpress_api import AliexpressApi
from aliexpress_api import models

appKey = "xxxxxx"
appSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
trackingId = "xxxxxxxxx"

ext_aliexpress = AliexpressApi(appKey, appSecret, models.Language.EN, models.Currency.EUR, trackingId)
product = ext_aliexpress.get_hotproducts(max_sale_price=3000, category_ids="44", target_currency="EUR", ship_to_country="IT").products[0]
shipping = ext_aliexpress.get_affiliate_product_shipping_info(product_id=product.product_id, sku_id=product.sku_id, ship_to_country="IT", target_currency="EUR", target_sale_price=product.target_sale_price, tax_rate=0.01)
print(f"Product link: {product.promotion_link}")
print(f"Shipping info for product {product.product_id}:")
print(f"Delivery days: {shipping.delivery_days}")
print(f"Shipping fee: {shipping.shipping_fee}")
print(f"Max delivery days: {shipping.max_delivery_days}")
print(f"Min delivery days: {shipping.min_delivery_days}")
print(f"Shipping from: {shipping.ship_from_country}")

iu2frl avatar Apr 15 '25 13:04 iu2frl