Re: Access via Python following instructions - Notworking (UnauthorizedAccess, 401 , ...)

Access via Python following instructions - Notworking (UnauthorizedAccess, 401 , ...)

Hoobee
Tourist
6 0 0

Hi,

 

I would like to access my shopify admin via a custom app I have created. I followed the instructions here:

 

https://shopify.github.io/shopify_python_api/?shpxid=eaf6a997-C8CB-4E41-5486-BAA167023E5E 

 

Which let to this code:

 

 

 

import shopify as shopify


shop_url_simple = "MYSITE.myshopify.com"
api_version = "2022-07"
API_KEY= "..."
PASSWORD = "...."


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

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

 

 

 

 

When I run this I receive:

 

 

 

pyactiveresource.connection.UnauthorizedAccess: Response(code=401, body="b'{"errors":"[API] Invalid API key or access token (unrecognized login or wrong password)"}'"  (...)

 

 

 

 

What I am doing wrong?

Reply 1 (1)

Umiko
Shopify Staff
42 8 13

Hi @Hoobee 👋

 

I would recommend working through our most up to date instructions here on getting started with the Shopify Admin API Python Library. Hope that helps!

Umiko | API Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog