{"library":"python-amazon-sp-api","title":"Amazon Selling Partner API (SP-API) Python Client","description":"python-amazon-sp-api is a comprehensive Python wrapper for the Amazon Selling Partner API (SP-API). It provides a convenient way to interact with various Amazon SP-API endpoints for tasks such as order management, inventory, reports, and more. The library is actively maintained, with frequent updates to support new API versions and features. The current stable version is 2.1.8.","language":"python","status":"active","last_verified":"Fri May 15","install":{"commands":["pip install python-amazon-sp-api"],"cli":null},"imports":["from sp_api.api import Orders","from sp_api.base import Marketplaces","from sp_api.base import SellingPartnerAPI","from sp_api.base import Client"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import os\nfrom sp_api.api import Orders\nfrom sp_api.base import Marketplaces\n\n# It is highly recommended to set these as environment variables\n# for security and ease of management.\nREFRESH_TOKEN = os.environ.get('SP_API_REFRESH_TOKEN', 'YOUR_REFRESH_TOKEN_HERE')\nLWA_APP_ID = os.environ.get('SP_API_LWA_APP_ID', 'YOUR_LWA_APP_ID_HERE')\nLWA_CLIENT_SECRET = os.environ.get('SP_API_LWA_CLIENT_SECRET', 'YOUR_LWA_CLIENT_SECRET_HERE')\nAWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID', 'YOUR_AWS_ACCESS_KEY_ID_HERE')\nAWS_SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY', 'YOUR_AWS_SECRET_ACCESS_KEY_HERE')\nIAM_ROLE_ARN = os.environ.get('SP_API_IAM_ROLE_ARN', 'YOUR_IAM_ROLE_ARN_HERE') # If using IAM\n\ntry:\n    client = Orders(\n        refresh_token=REFRESH_TOKEN,\n        lwa_app_id=LWA_APP_ID,\n        lwa_client_secret=LWA_CLIENT_SECRET,\n        aws_access_key_id=AWS_ACCESS_KEY_ID,\n        aws_secret_access_key=AWS_SECRET_ACCESS_KEY,\n        role_arn=IAM_ROLE_ARN, # Use role_arn if using IAM for AWS credentials\n        marketplace=Marketplaces.US # Or specify your target marketplace\n    )\n\n    # Example: Get orders created after a specific date\n    response = client.get_orders(CreatedAfter='2023-01-01T00:00:00Z', MaxResultsPerPage=10)\n    print(\"Successfully retrieved orders:\")\n    print(response.payload)\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\n    # Specific error handling for SP-API e.g., AuthorizationError, RateLimitError\n","lang":"python","description":"This quickstart demonstrates how to initialize an `Orders` client, which is a common use case for the Amazon SP-API. It highlights the required authentication parameters (LWA credentials, AWS IAM role/keys) and shows how to make a basic API call to retrieve orders. Ensure your environment variables are correctly set for authentication.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-15","installed_version":"2.1.8","pypi_latest":"2.1.8","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":2.7,"avg_import_s":0.56,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"python-amazon-sp-api","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.45,"mem_mb":11.2,"disk_size":"29.9M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"python-amazon-sp-api","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.6,"import_time_s":0.34,"mem_mb":11.2,"disk_size":"31M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"python-amazon-sp-api","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.77,"mem_mb":12.3,"disk_size":"32.8M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"python-amazon-sp-api","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.7,"import_time_s":0.75,"mem_mb":12.3,"disk_size":"34M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"python-amazon-sp-api","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.6,"mem_mb":12,"disk_size":"24.4M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"python-amazon-sp-api","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.5,"import_time_s":0.64,"mem_mb":12,"disk_size":"26M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"python-amazon-sp-api","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.56,"mem_mb":12.3,"disk_size":"24.0M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"python-amazon-sp-api","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.6,"import_time_s":0.61,"mem_mb":12.3,"disk_size":"25M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"python-amazon-sp-api","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.44,"mem_mb":10.7,"disk_size":"29.2M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"python-amazon-sp-api","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":3,"import_time_s":0.39,"mem_mb":10.7,"disk_size":"30M"}]}}