Private Shopify API APP in Python

Topic summary

A developer is asking whether there’s an issue with their approach to using Shopify’s private API in Python. Instead of following the official documentation’s recommended method, they’re using the requests library directly with the API key and password in the URL format:

https://{api_key}:{password}@{shopname}.myshopify.com/admin/api/2024-01/orders.json

The official approach involves:

  • Setting up the Shopify session with shopify.ShopifyResource.set_site(shop_url) for private apps
  • Using ActiveResource instances to interact with the API (e.g., shopify.Product.find())
  • Leveraging built-in methods for CRUD operations

The question centers on whether their direct HTTP requests approach differs functionally from the documented SDK method, and if there are any problems or disadvantages to their implementation. The discussion remains open with no responses yet addressing the validity or potential issues of this alternative approach.

Summarized with AI on November 6. AI used: claude-sonnet-4-5-20250929.

Hello guys,

is there a problem, when I didn’t use the Shopify Api like this:

  1. First create a new application in either the partners admin or your store admin. For a private App you’ll need the API_KEY and the PASSWORD otherwise you’ll need the API_KEY and SHARED_SECRET.

  2. For a private App you just need to set the base site url as follows:

    python
    shop_url = "https://%s:%s@SHOP_NAME.myshopify.com/admin" % (API_KEY, PASSWORD)
    shopify.ShopifyResource.set_site(shop_url)
    

    That’s it you’re done, skip to step 6 and start using the API! For a partner App you will need to supply two parameters to the Session class before you instantiate it:

    python
    shopify.Session.setup(api_key=API_KEY, secret=SHARED_SECRET)
    
  3. Now you’re ready to make authorized API requests to your shop! Data is returned as ActiveResource instances:

    python
    shop = shopify.Shop.current
    
    # Get a specific product
    product = shopify.Product.find(179761209)
    
    # Create a new product
    new_product = shopify.Product()
    new_product.title = "Burton Custom Freestyle 151"
    new_product.product_type = "Snowboard"
    new_product.vendor = "Burton"
    success = new_product.save() #returns false if the record is invalid
    # or
    if new_product.errors:
        #something went wrong, see new_product.errors.full_messages() for example
    
    # Update a product
    product.handle = "burton-snowboard"
    product.save()
    

    Alternatively, you can use temp to initialize a Session and execute a command which also handles temporarily setting ActiveResource::Base.site:

    python
    with shopify.Session.temp("SHOP_NAME.myshopify.com", token):
       product = shopify.Product.find()
    

like they write it in the doc?

Now I use the API KEY with requests, like this:

api_endpoint = [email removed]
response = requests.get(api_endpoint)

Is there a problem? Where is the difference?