【发布时间】:2021-12-18 17:23:14
【问题描述】:
我已将代码更新为以下内容:
@app.route('/products_linking', methods=['GET'])
# @helpers.verify_web_call
def products_linking():
shop = request.args.get('shop')
global ACCESS_TOKEN
if ACCESS_TOKEN:
url = f'https://{shop}.myshopify.com/admin/api/2021-10/'
def get_products():
endpoint = 'products.json'
r = requests.get(url + endpoint)
return r.json()
products = get_products()
print(products)
print(shop)
return render_template('products_linking.html', shop=shop, products=products)
当我在我的应用程序中单击 /products_linking 的链接时,我得到 {'errors': '[API] Invalid API key or access token (unrecognized login or wrong password)'} 产品和商店的 'None'多变的。如果 if ACCESS_TOKEN: 块内的代码正在执行,为什么我会收到无效的访问令牌错误?还有为什么 shop 变量的值返回为 None?
【问题讨论】:
标签: python json flask python-requests shopify