Skip to content

πŸš€A collection of Python scripts for integrating with Alibaba.com's Seller API, allowing you to manage orders, logistics, and more.

License

Notifications You must be signed in to change notification settings

ronknight/alibaba-seller-api

Repository files navigation

Edit in Eraser

A collection of Python scripts for integrating with Alibaba's Seller API, allowing you to manage orders, logistics, and more.

Requirements β€’ Setup β€’ Scripts Overview β€’ Usage β€’ Logging β€’ Disclaimer β€’ Diagrams


πŸ“‹ Requirements

The project dependencies are listed in the requirements.txt file. To install all required packages, run:

pip install -r requirements.txt

Key dependencies include:

  • requests
  • python-dotenv
  • aiohttp
  • alibabacloud-openplatform20191219
  • aliyun-python-sdk-core
  • and various other packages for data processing and analysis

Additional requirements:

  • Python 3.x
  • Alibaba Seller API credentials (APP_KEY, APP_SECRET, REDIRECT_URI)

πŸ› οΈ Setup

  1. Clone this repository:
git clone https://github.com/ronknight/alibaba-seller-api.git
cd alibaba-seller-api
  1. Install required packages:
pip install -r requirements.txt
  1. Create a .env file in the root directory with your Alibaba API credentials:
APP_KEY=your_app_key
APP_SECRET=your_app_secret
REDIRECT_URI=your_redirect_uri

πŸ“œ Scripts Overview

  1. 1initiate.py

    • Initiates the OAuth authorization process
    • Generates the authorization URL
    • Extracts and saves the authorization code and state
  2. 2createtoken.py

    • Creates an access token using the authorization code
    • Updates the .env file with the new session key (access token)
    • Logs API requests and responses
  3. sellerorderlist.py

    • Retrieves a list of seller orders
    • Uses the alibaba.seller.order.list API method
    • Logs API requests and responses
  4. sellerorderget.py

    • Retrieves details of a specific seller order
    • Uses the alibaba.seller.order.get API method
    • Requires an e_trade_id (order ID) as a command-line argument
  5. sellerorderfundget.py

    • Retrieves fund information for a specific seller order
    • Uses the alibaba.seller.order.fund.get API method
    • Requires an e_trade_id (order ID) as a command-line argument
  6. sellerorderlogisticsget.py

    • Retrieves logistics information for a specific seller order
    • Uses the alibaba.seller.order.logistics.get API method
    • Requires an e_trade_id (order ID) as a command-line argument
  7. sellerordershipping.py

    • Updates shipping information for a specific order
    • Uses the alibaba.seller.order.shipping API method
    • Requires multiple command-line arguments for shipping details

πŸš€ Usage

  1. Run 1initiate.py to start the authorization process and obtain the AUTH_CODE.
  2. Run 2createtoken.py to generate the access token (SESSION_KEY).
  3. Use the other scripts as needed to interact with seller order data.

Examples:

python sellerorderget.py <e_trade_id>
python sellerorderfundget.py <e_trade_id>
python sellerorderlogisticsget.py <e_trade_id>
python sellerordershipping.py <service_provider> <trade_id> <logistics_type> <tracking_number> <attachments_json>

πŸ“Š Logging

All API requests and responses are logged in the api_logs/ directory for debugging and auditing purposes.

⚠️ Disclaimer

This project is for educational and integration purposes only. Ensure you have the necessary permissions and comply with Alibaba's terms of service when using these scripts. The authors are not responsible for any misuse or damage caused by this project.

πŸ“ˆ Diagrams

About

πŸš€A collection of Python scripts for integrating with Alibaba.com's Seller API, allowing you to manage orders, logistics, and more.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Languages