A Python-based integration for the Alibaba Open API, providing authentication, token management, and product listing functionalities.
Requirements β’ Usage β’ API Endpoints β’ Scripts β’ Disclaimer β’ Architecture
To run this project, you need:
- Python 3.7+
- pip (Python package installer)
Required Python packages:
anyio==4.4.0
argon2-cffi==23.1.0
requests==2.32.3
python-dotenv==1.0.1
A full list of dependencies can be found in the requirements.txt file.
-
Clone the repository:
git clone https://github.com/ronknight/alibaba-open-api.git cd alibaba-open-api -
Install the required packages:
pip install -r requirements.txt -
Set up your
.envfile with the necessary credentials:APP_KEY=your_app_key APP_SECRET=your_app_secret REDIRECT_URI=your_redirect_uri -
Run the scripts in the following order:
python 1initiate.py python 2createtoken.py python 3refreshtoken.py python productlist.py
| Endpoint | Description |
|---|---|
/auth/token/create |
Create new access and refresh tokens |
/auth/token/refresh |
Refresh existing access token |
| Endpoint | Description |
|---|---|
/icbu/product/list |
Get list of products |
/icbu/product/category/get |
Get product category details |
/icbu/product/schema/level/get |
Get product schema level |
| Endpoint | Description |
|---|---|
/alibaba/icbu/category/id/mapping |
Get category ID mapping |
/icbu/product/category/get |
Get category information |
1initiate.py: Initiates the OAuth process and obtains the authorization code.2createtoken.py: Creates access and refresh tokens using the authorization code.3refreshtoken.py: Refreshes the access token using the refresh token.productlist.py: Retrieves the product list using the access token.product_category_get.py: Gets product category information.product_schema_level_get.py: Gets product schema level information.
This project is for educational purposes only. Ensure you comply with Alibaba's API usage terms and conditions.
sequenceDiagram
participant Client
participant Auth
participant API
Client->>Auth: 1. Request Authorization Code
Auth-->>Client: 2. Return Auth Code
Client->>API: 3. Exchange Auth Code for Tokens
API-->>Client: 4. Return Access & Refresh Tokens
Client->>API: 5. API Requests with Access Token
API-->>Client: 6. API Response
flowchart LR
A[Start] --> B{Has Access Token?}
B -- No --> C[Request Token]
B -- Yes --> D[Product API]
C --> D
D --> E[Get Categories]
D --> F[Get Products]
D --> G[Get Schema]
E & F & G --> H[Process Data]
H --> I[End]