Skip to content

πŸ›’πŸ™οΈ This Python project demonstrates how to interact with the Alibaba.com/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.

License

Notifications You must be signed in to change notification settings

ronknight/alibaba-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

45 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Edit in Eraser

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


πŸ“‹ Prerequisites

Before running the scripts, make sure you have the following:

  1. Python installed on your system.
  2. Required libraries installed. You can install them using pip:
    pip install requests python-dotenv
    
  3. 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
    

πŸš€ Usage

  1. Clone the repository:
    git clone https://github.com/ronknight/alibaba-api.git
    cd alibaba-api
    
  2. Set up your .env file with the required credentials.
  3. Run the scripts as needed (see the Scripts section for details on each script).

✨ Features

  1. Authentication: Handles the OAuth 2.0 flow for Alibaba/Taobao API.
  2. Token Management: Creates and manages access tokens.
  3. Product Management: Retrieves, updates, adds, and manages product information.
  4. Group Management: Retrieves product group information.
  5. Category Management: Retrieves category information and attributes.
  6. Shipping Management: Retrieves shipping line template information.
  7. Photobank Management: Lists, operates, and manages photobank groups.
  8. Logging: Comprehensive logging of API requests and responses.
  9. Error Handling: Robust error handling and reporting.
  10. Product Schema Management: Adds, retrieves, and renders product schemas.

πŸ“¦ 1. Product List (productlist.py)

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>

πŸ” 2. Product Get (productget.py)

Retrieves detailed information about a specific product.

python productget.py <product_id>

πŸ‘₯ 3. Product Group Get (productgroupget.py)

Retrieves information about a product group.

python productgroupget.py <group_id>

πŸ”“ 4. Product ID Decrypt (productiddecrypt.py)

Decrypts a product ID.

python productiddecrypt.py <product_id>

πŸ“„ 5. Product Schema (productschema.py)

Retrieves the schema for product information.

python productschema.py

πŸ”„ 6. Product Update Field (productupdatefield.py)

Updates specific fields of a product.

python productupdatefield.py <product_id>

πŸ”„ 7. Product Update Field Copy (productupdatefieldcopy.py)

A variation of the product update field script, focusing on updating the InternalSKU.

python productupdatefieldcopy.py <product_id>

🚒 8. Wholesale Shipping Line Template (wholesaleshippinglinetemplate.py)

Retrieves the list of shipping line templates.

python wholesaleshippinglinetemplate.py

🏷️ 9. Category Attribute Get (categoryattributeget.py)

Retrieves attributes for a specific category.

python categoryattributeget.py <cat_id>

πŸ“ 10. Category Get (categoryget.py)

Retrieves information about a specific category.

python categoryget.py <cat_id>

πŸ–ΌοΈ 11. Photobank Group List (photobankgrouplist.py)

Retrieves a list of photobank groups.

python photobankgrouplist.py

πŸ–ΌοΈ 12. Photobank Group Operate (photobankgroupoperate.py)

Performs operations on photobank groups (add, delete, rename).

python photobankgroupoperate.py <group_name> <operation>

πŸ–ΌοΈ 13. Photobank List (photobanklist.py)

Retrieves a list of photos from the photobank.

python photobanklist.py <page_size>

βž• 14. Product Add (productadd.py)

Adds a new product to the catalog.

python productadd.py

πŸ”„ 15. Product Batch Update Display (productbatchupdatedisplay.py)

Updates the display status for multiple products at once.

python productbatchupdatedisplay.py <new_display> <product_id_list>

πŸ“ 16. Product Schema Add Draft (productschemaadddraft.py)

Adds a draft product schema.

python productschemaadddraft.py <cat_id>

πŸ“„ 17. Product Schema Get (productschemaget.py)

Retrieves a product schema.

python productschemaget.py <product_id>

πŸ–₯️ 18. Product Schema Render (productschemarender.py)

Renders a product schema.

python productschemarender.py <cat_id> <product_id>

πŸ–₯️ 19. Product Schema Render Draft (productschemarenderdraft.py)

Renders a draft product schema.

python productschemarenderdraft.py <cat_id> <draft_product_id>

βž• 20. Product Schema Add (productschemaadd.py)

Adds a product schema.

python productschemaadd.py <cat_id>

πŸ”„ 21. Product Scheme Update (productschemaupdate.py)

Updates a product's schema.

python productschemaupdate.py <cat_id> 

πŸ“Š 22. Product Score Get (productscoreget.py)

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.

πŸ“Š Diagrams

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.

About

πŸ›’πŸ™οΈ This Python project demonstrates how to interact with the Alibaba.com/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.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Languages