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
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)
- Clone this repository:
git clone https://github.com/ronknight/alibaba-seller-api.git
cd alibaba-seller-api
- Install required packages:
pip install -r requirements.txt
- 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
-
1initiate.py
- Initiates the OAuth authorization process
- Generates the authorization URL
- Extracts and saves the authorization code and state
-
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
-
sellerorderlist.py
- Retrieves a list of seller orders
- Uses the alibaba.seller.order.list API method
- Logs API requests and responses
-
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
-
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
-
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
-
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
- Run
1initiate.py
to start the authorization process and obtain the AUTH_CODE. - Run
2createtoken.py
to generate the access token (SESSION_KEY). - 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>
All API requests and responses are logged in the api_logs/
directory for debugging and auditing purposes.
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.