如何为shopify应用生成密码

时间:2015-11-17 11:26:16

标签: python django shopify

documentation之后,这就是我在控制台中测试的内容:

import os
import shopify

SHOPIFY_API_KEY = os.environ.get('SHOPIFY_API_KEY')
SHOPIFY_API_SECRET = os.environ.get('SHOPIFY_API_SECRET')
SHOPIFY_API_PASSWORD = '' # os.environ.get('SHOPIFY_API_PASSWORD')  # TODO: I don't have this

shop_url = "https://%s:%s@appappapp.myshopify.com/admin" % (SHOPIFY_API_KEY, SHOPIFY_API_PASSWORD)
shopify.ShopifyResource.set_site(shop_url)
shopify.Session.setup(api_key=SHOPIFY_API_KEY, secret=SHOPIFY_API_SECRET)
products = shopify.Product.find(limit=3)

我当然得到了:

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

我不知道如何生成密码。我的shopify连接与django集成,通过SHOPIFY_API_KEY / SHOPIFY_API_SECRET,在会话中存储访问令牌。

在网址https://app.shopify.com/services/partners/api_clients/<app-id>中,我可以生成机密和刷新令牌,但没有密码。

如何让它在控制台上运行?如何为shopify应用生成密码?

1 个答案:

答案 0 :(得分:0)

您不需要生成Shopify密码。您只需安装API密钥和密钥即可为合作伙伴应用安装应用。

您需要私钥的API密钥和密码。 您需要合作伙伴应用的API密钥和密钥。

基本上,您需要按照以下步骤操作。

1) setup your Shopify app using your API key and secret.

2) setup the permission url by specifying your store and scope

3) grab the values returned by the permission url in order to get your
Shopify permanent token. (you get the token by doing a call using
the params you got from step 2)

4) use the token you have to make all your API calls