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 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.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 723da494edc6a0fd8fc6dc5534477cade9f2e8dbf6ca4a939589148c4aaa9664 |
|
MD5 | ad85d8e25208356a22b579e2472d9753 |
|
BLAKE2b-256 | d86644ad7dc9bfa7831e036f69451bb42486b4b2cb71bd87e5e7eb53ea16ae59 |
File details
Details for the file smartscout_api-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: smartscout_api-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.9 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 | 7cdb2442c95fd028cf2b42a49ebb82036ad8acfb371de18ce8524a3c3f3e718e |
|
MD5 | 5721a2337a7ea4b06d9b100281b7abdb |
|
BLAKE2b-256 | 2250a60aefad5537588a8a31c378ca85b3a0a0db0ef1531babe7860292286658 |