This Python project demonstrates how to interact with the Alibaba/Taobao API to retrieve product information and manage authentication. It uses the `requests` library to make HTTP requests and the `dotenv` library to load environment variables from a `.env` file.
Prerequisites β’ Usage β’ Features β’ Diagrams
Before running the scripts, make sure you have the following:
- Python installed on your system.
 - Required libraries installed. You can install them using 
pip:pip install requests python-dotenv - A .env file in the project directory containing your Alibaba/Taobao API credentials:
APP_KEY=your_app_key APP_SECRET=your_app_secret REDIRECT_URI=your_redirect_uri SESSION_KEY=your_session_key AUTH_CODE=your_auth_code 
- Clone the repository:
git clone https://github.com/ronknight/alibaba-api.git cd alibaba-api - Set up your 
.envfile with the required credentials. - Run the scripts as needed (see the Scripts section for details on each script).
 
- Authentication: Handles the OAuth 2.0 flow for Alibaba/Taobao API.
 - Token Management: Creates and manages access tokens.
 - Product Management: Retrieves, updates, adds, and manages product information.
 - Group Management: Retrieves product group information.
 - Category Management: Retrieves category information and attributes.
 - Shipping Management: Retrieves shipping line template information.
 - Photobank Management: Lists, operates, and manages photobank groups.
 - Logging: Comprehensive logging of API requests and responses.
 - Error Handling: Robust error handling and reporting.
 - Product Schema Management: Adds, retrieves, and renders product schemas.
 
Retrieves a list of products based on search criteria. Takes command-line arguments for subject, page size, and page number. Makes a POST request to the Alibaba API to retrieve product information. Logs request and response details. Handles and logs errors. Prints product subjects from the response.
python productlist.py <subject> <page_size> <page_number>Retrieves detailed information about a specific product.
python productget.py <product_id>Retrieves information about a product group.
python productgroupget.py <group_id>Decrypts a product ID.
python productiddecrypt.py <product_id>Retrieves the schema for product information.
python productschema.pyUpdates specific fields of a product.
python productupdatefield.py <product_id>A variation of the product update field script, focusing on updating the InternalSKU.
python productupdatefieldcopy.py <product_id>Retrieves the list of shipping line templates.
python wholesaleshippinglinetemplate.pyRetrieves attributes for a specific category.
python categoryattributeget.py <cat_id>Retrieves information about a specific category.
python categoryget.py <cat_id>Retrieves a list of photobank groups.
python photobankgrouplist.pyPerforms operations on photobank groups (add, delete, rename).
python photobankgroupoperate.py <group_name> <operation>Retrieves a list of photos from the photobank.
python photobanklist.py <page_size>Adds a new product to the catalog.
python productadd.pyUpdates the display status for multiple products at once.
python productbatchupdatedisplay.py <new_display> <product_id_list>Adds a draft product schema.
python productschemaadddraft.py <cat_id>Retrieves a product schema.
python productschemaget.py <product_id>Renders a product schema.
python productschemarender.py <cat_id> <product_id>Renders a draft product schema.
python productschemarenderdraft.py <cat_id> <draft_product_id>Adds a product schema.
python productschemaadd.py <cat_id>Updates a product's schema.
python productschemaupdate.py <cat_id> Get a product's score.
python productschemaupdate.py <cat_id> Each script includes error handling and logging functionality. Logs are stored in the api_logs/ directory.
Note: This project is for demonstration purposes only. You may need to modify the scripts based on your specific use case and the latest Alibaba/Taobao API documentation.
This comprehensive README now includes information about all the scripts in the project, providing a clear overview of each script's functionality and usage instructions. The structure remains consistent with the original README, while incorporating details about all the new scripts.


