skip to Main Content

I am using shopify api in python first time using sameple code availbe on shopify documentation and getting following error:

File “D:UsersAmmarAppDataLocalContinuumanaconda3libhttpclient.py”, line 890, in _get_hostport
raise InvalidURL(“nonnumeric port: ‘%s'” % host[i+1:])

InvalidURL: nonnumeric port: ‘[email protected]

Python3. Shopify-API

import shopify
shop_url = "https://apikey:[email protected]/admin"
shopify.ShopifyResource.set_site(shop_url)

2

Answers


  1. This is an existing issue in Shopify Python Package. You need to upgrade to API Version – 5.0.1. You can find more information about the issue raised here – Link.

    Run pip install ShopifyAPI==5.0.1 to upgrade your local package.

    Shopify 5.0.1 Package – Link

    Update (Work Around):

    #instead of:
    shop_url = "https://'API_KEY':'PASSWORD'@SHOP_NAME.myshopify.com/admin"
    shopify.ShopifyResource.set_site(shop_url)
    
    #use:
    shop_url = "https://SHOP_NAME.myshopify.com/admin"
    shopify.ShopifyResource.set_user("API_KEY")
    shopify.ShopifyResource.set_password("PASSWORD")
    shopify.ShopifyResource.set_site(shop_url)
    
    Login or Signup to reply.
  2. It’s nowhere to be found by simply looking at the docs but I found the response on their own tests here

    They instance their session something like this:

    shopify.ShopifyResource.site = "https://this-is-my-test-show.myshopify.com/admin/api/unstable"
    shopify.ShopifyResource.password = None
    shopify.ShopifyResource.user = None
    

    I’ll definitely be looking more at their tests instead of their docs, it seems pretty bad documented

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search