Skip to main content

A Python client for the SmartScout API

Project description

SmartScout API Python Package

This Python package provides a convenient wrapper for the SmartScout API, allowing you to easily interact with SmartScout's powerful e-commerce analytics tools in your Python projects.

Features

  • Easy-to-use client for all SmartScout API endpoints
  • Type-safe request and response models
  • Automatic pagination handling
  • Comprehensive error handling

Installation

You can install the SmartScout API Python package using pip:

pip install smartscout-api

Quick Start

Here's a quick example of how to use the SmartScout API client:

from smartscout import SmartScoutClient
from smartscout.models import SearchProductsRequest, MarketplaceId

# Initialize the client with your API key
client = SmartScoutClient(api_key="your_api_key_here")

# Create a request to search for products
request = SearchProductsRequest(
    marketplace=MarketplaceId.US,
    brand_name="Example Brand",
    review_count={"min": 100}
)

# Make the API call
response = client.search_products(request)

# Process the results
for product in response.data:
    print(f"Product: {product.asin}, Title: {product.title}, Price: ${product.price}")

# If there are more pages, you can access them like this:
while response.paging.has_more_records:
    request.page.id = response.paging.next_page_id
    response = client.search_products(request)
    # Process the next page of results...

Available Methods

The SmartScoutClient provides methods for all SmartScout API endpoints, including:

  • search_brands()
  • search_products()
  • search_search_terms()
  • search_sellers()
  • get_organic_ranks()
  • get_product_history_scope()
  • get_relevant_products()
  • get_subcategory_brands()
  • get_brand_sales_history()
  • get_brand_sales_history_by_subcategories()
  • get_brand_scope()
  • get_brand_scope_top_products()
  • get_relevant_search_terms()
  • get_search_term_history()

Each method corresponds to a specific API endpoint and accepts a request model as its parameter.

Error Handling

The package includes custom exceptions for various error scenarios:

  • SmartScoutAPIError: General API errors
  • AuthenticationError: Issues with API key authentication
  • RateLimitError: API rate limit exceeded
  • ValidationError: Request validation errors
  • ResourceNotFoundError: Requested resource not found
  • InsufficientPermissionsError: Lack of permissions for an action
  • ServiceUnavailableError: SmartScout service unavailable
  • RequestTimeoutError: API request timeout
  • InvalidRequestError: Invalid request parameters
  • UnexpectedResponseError: Unexpected API response format

You can catch these exceptions to handle different error scenarios in your code:

from smartscout.exceptions import SmartScoutAPIError, RateLimitError

try:
    response = client.search_products(request)
except RateLimitError:
    print("Rate limit exceeded. Please wait before making more requests.")
except SmartScoutAPIError as e:
    print(f"An API error occurred: {e.message}")

Documentation

For detailed information about the SmartScout API, including all available endpoints and request/response models, please refer to the official SmartScout API documentation.

Contributing

We welcome contributions to the SmartScout API Python package! Please see our contribution guidelines for more information on how to get started.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Support

If you encounter any issues or have questions about using the SmartScout API Python package, please open an issue on our GitHub repository.

For questions related to the SmartScout API itself or your SmartScout account, please contact SmartScout support directly.

Disclaimer

This package is not officially maintained by SmartScout. It is a community-developed wrapper for the SmartScout API.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

smartscout_api-0.1.0.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

smartscout_api-0.1.0-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file smartscout_api-0.1.0.tar.gz.

File metadata

  • Download URL: smartscout_api-0.1.0.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for smartscout_api-0.1.0.tar.gz
Algorithm Hash digest
SHA256 723da494edc6a0fd8fc6dc5534477cade9f2e8dbf6ca4a939589148c4aaa9664
MD5 ad85d8e25208356a22b579e2472d9753
BLAKE2b-256 d86644ad7dc9bfa7831e036f69451bb42486b4b2cb71bd87e5e7eb53ea16ae59

See more details on using hashes here.

File details

Details for the file smartscout_api-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for smartscout_api-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7cdb2442c95fd028cf2b42a49ebb82036ad8acfb371de18ce8524a3c3f3e718e
MD5 5721a2337a7ea4b06d9b100281b7abdb
BLAKE2b-256 2250a60aefad5537588a8a31c378ca85b3a0a0db0ef1531babe7860292286658

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page