{"library":"shopifyapi","title":"Shopify API Python","description":"The `shopifyapi` library (version 12.7.0) enables Python developers to programmatically access the administrative section of Shopify stores. It provides an ActiveResource-like interface for interacting with both the REST and GraphQL APIs. Shopify releases new API versions quarterly, which often include breaking changes that developers need to anticipate and manage in their integrations.","language":"python","status":"active","last_verified":"Sat May 16","install":{"commands":["pip install ShopifyAPI"],"cli":{"name":"shopify","version":"sh: 1: shopify: not found"}},"imports":["import shopify","from shopify import Session","from shopify import ShopifyResource"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import os\nimport shopify\n\n# --- Configuration from Environment Variables ---\n# For a Private App, you need API Key and Password\nSHOPIFY_API_KEY = os.environ.get('SHOPIFY_API_KEY', 'your_api_key')\nSHOPIFY_PASSWORD = os.environ.get('SHOPIFY_PASSWORD', 'your_password')\nSHOPIFY_SHOP_NAME = os.environ.get('SHOPIFY_SHOP_NAME', 'your-shop-name') # e.g., 'my-awesome-store'\nSHOPIFY_API_VERSION = os.environ.get('SHOPIFY_API_VERSION', '2024-07') # Use a stable, supported API version\n\n# Construct the shop URL for a private app\nshop_url = f\"https://{SHOPIFY_API_KEY}:{SHOPIFY_PASSWORD}@{SHOPIFY_SHOP_NAME}.myshopify.com/admin\"\n\n# Set up the API session\nshopify.ShopifyResource.set_site(shop_url)\nshopify.ShopifyResource.set_api_version(SHOPIFY_API_VERSION)\n\ntry:\n    # Activate a temporary session to make calls\n    with shopify.Session.temp(shop_url, SHOPIFY_API_VERSION):\n        # Example: Fetching the current shop's details\n        shop = shopify.Shop.current()\n        print(f\"Connected to shop: {shop.name} (ID: {shop.id})\")\n\n        # Example: Fetching a product by ID (replace with a real product ID from your store)\n        # product_id = 1234567890123 # Replace with an actual product ID\n        # try:\n        #     product = shopify.Product.find(product_id)\n        #     print(f\"Found product: {product.title} (ID: {product.id})\")\n        # except Exception as e:\n        #     print(f\"Could not find product {product_id}: {e}\")\n\n        # Example: Making a GraphQL query (Recommended for new development)\n        graphql_client = shopify.GraphQL()\n        query = \"\"\"\n            query { \n                shop { \n                    name \n                    id \n                } \n            }\n        \"\"\"\n        result = graphql_client.execute(query)\n        print(f\"GraphQL Shop Info: {result}\")\n\nexcept shopify.pyactiveresource.connection.ClientError as e:\n    print(f\"API Client Error: {e.response.code} - {e.response.message}\")\n    print(\"Check your API Key, Password, Shop Name, and API Version.\")\nexcept Exception as e:\n    print(f\"An unexpected error occurred: {e}\")\n","lang":"python","description":"This quickstart demonstrates how to authenticate with the Shopify API using a private app's API key and password, activate a session, and perform basic operations like fetching shop details and making a GraphQL query. Remember to set your `SHOPIFY_API_KEY`, `SHOPIFY_PASSWORD`, `SHOPIFY_SHOP_NAME`, and `SHOPIFY_API_VERSION` environment variables or replace the placeholder values. Shopify recommends using GraphQL for new development.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-16","installed_version":"12.7.0","pypi_latest":"12.7.0","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":4.5,"avg_import_s":0.39,"wheel_type":"sdist"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"ShopifyAPI","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.33,"mem_mb":6.7,"disk_size":"23.0M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"ShopifyAPI","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":4.5,"import_time_s":0.23,"mem_mb":6.7,"disk_size":"24M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"ShopifyAPI","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.56,"mem_mb":7.1,"disk_size":"25.4M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"ShopifyAPI","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":3.9,"import_time_s":0.48,"mem_mb":7.1,"disk_size":"27M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"ShopifyAPI","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.42,"mem_mb":7,"disk_size":"15.4M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"ShopifyAPI","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":5.1,"import_time_s":0.44,"mem_mb":7,"disk_size":"17M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"ShopifyAPI","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.4,"mem_mb":7.3,"disk_size":"15.1M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"ShopifyAPI","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":4.3,"import_time_s":0.41,"mem_mb":7.3,"disk_size":"16M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"ShopifyAPI","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.31,"mem_mb":6.8,"disk_size":"22.6M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"ShopifyAPI","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":4.8,"import_time_s":0.32,"mem_mb":6.8,"disk_size":"24M"}]}}