Skip to content

fuongz/ecommerce-api-wrapper

Repository files navigation

Ecommerce API Wrapper - Python SDK

Codecov PyPI - Version

This is an unofficial Python SDK for Popular Ecommerce (Tokopedia, Lazada). The project is still under development.

E-commerce APIs

Features

  • Search products from Tokopedia and Lazada
  • Get product details from Tokopedia and Lazada
  • Get product reviews from Tokopedia and Lazada
  • Get product categories from Tokopedia and Lazada
  • Get product brands from Tokopedia and Lazada

Libraries used

This project uses the following libraries:

  • requests for making HTTP requests
  • marshmallow for serializing and deserializing JSON data
  • urllib3 for making secure HTTP requests
  • tqdm for displaying progress bars

Installation

You can install the package directly from PyPI using pip:

pip install ecommerce_api_wrapper

Usage

Here is a simple example of how to use the package:

from ecommerce_api_wrapper import EcommerceApiWrapper

if __name__ == "__main__":
    crawler = EcommerceApiWrapper(
        ecom_type="tokopedia",
    )
    response = crawler.search_products(["samsung"])
    print(response)

    # RESULT:
    #

Development

Project Structure

ecommerce_api_wrapper/
├── src/
│   ├── ecommerce_api_wrapper/
│   │   ├── __init__.py
│   │   ├── __version__.py
│   │   ├── ecommerce_api_wrapper.py
│   │   ├── providers/
│   │   │   ├── __init__.py
│   │   │   ├── lazada_api_wrapper/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── constants.py
│   │   │   │   ├── lazada.py
│   │   │   │   └── schemas/
│   │   │   └── tokopedia_api_wrapper/
│   │   │       ├── __init__.py
│   │   │       ├── constants.py
│   │   │       ├── tokopedia.py
│   │   │       ├── schemas/
│   │   │       └── utils/
│   │   └── utils/
│   │       ├── __init__.py
│   │       ├── faker.py
│   │       └── transform.py
├── tests/
│   └── unit_test.py
├── pyproject.toml
├── README.md
└── LICENSE

  • The src/ecommerce_api_wrapper directory contains the package code.
  • Each major provider (Lazada, Tokopedia) resides in its own subpackage under src/ecommerce_api_wrapper/providers.
  • Utility modules are grouped under utils.
  • Schemas for each provider are organized in their respective schemas folders.
  • src/ecommerce_api_wrapper/__init__.py allows importing the package.
  • tests contains test cases.

License