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 SmartScoutAPIClient
from smartscout.models import SearchProductsRequest, MarketplaceId
# Initialize the client with your API key
client = SmartScoutAPIClient(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 SmartScoutAPIClient
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 errorsAuthenticationError
: Issues with API key authenticationRateLimitError
: API rate limit exceededValidationError
: Request validation errorsResourceNotFoundError
: Requested resource not foundInsufficientPermissionsError
: Lack of permissions for an actionServiceUnavailableError
: SmartScout service unavailableRequestTimeoutError
: API request timeoutInvalidRequestError
: Invalid request parametersUnexpectedResponseError
: 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file smartscout_api-0.1.1.tar.gz
.
File metadata
- Download URL: smartscout_api-0.1.1.tar.gz
- Upload date:
- Size: 16.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 105e35b7b6340ec4afad13a688bd4877461b444978f9dd97a4c058da57c0f8d1 |
|
MD5 | af4574223708c4890d1bb62cbbc5bee8 |
|
BLAKE2b-256 | 34945d2fe66e432604ca04c1bc352e2551c9123c1b31213125154373ad385e7c |
File details
Details for the file smartscout_api-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: smartscout_api-0.1.1-py3-none-any.whl
- Upload date:
- Size: 17.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3b7b0d24e02f72524e9bea1af2b40101b148814951a6a7555b58b41cabdf159 |
|
MD5 | 1101e3083fd1d4d6b82e86881a1db610 |
|
BLAKE2b-256 | c0a14c713e02ae5e7596a62347a4685f5f6c76ddeaf0dd64c419bef4f248d33e |