简体   繁体   English

使用Python Shopify模块访问“ HTTP_X_SHOPIFY_SHOP_API_CALL_LIMIT”

[英]Access 'HTTP_X_SHOPIFY_SHOP_API_CALL_LIMIT' with Python Shopify Module

I am looking for a way to view the header information of my requests when calling the Shopify API. 我正在寻找一种在调用Shopify API时查看我的请求的标头信息的方法。

The API documentation says: API文档说:

You can check how many calls you've already made using the Shopify header that was sent in response to your API call: HTTP_X_SHOPIFY_SHOP_API_CALL_LIMIT (lists how many calls you've made for that particular shop) 您可以使用为响应API调用而发送的Shopify标头来检查您已经进行了多少次呼叫:HTTP_X_SHOPIFY_SHOP_API_CALL_LIMIT(列出您为该特定商店进行了多少次呼叫)

On a Shopify support page I found a thread asking this same question, and Shopify's response was: 在Shopify支持页面上,我发现一个线程问同样的问题,Shopify的回答是:

If (you are using) the python adapter then you probably need to use the get_headers method. 如果(正在使用)python适配器,则可能需要使用get_headers方法。 I'm not sure, I don't use this library. 我不确定,我不使用该库。

When exploring I have tried calls like the following: 探索时,我尝试了如下呼叫:

shopify.ShopifyResource.get_headers().get('HTTP_X_SHOPIFY_API_CALL_LIMIT')
>>None

Was able to access it via: 能够通过以下方式访问它:

resp_header = shopify.ShopifyResource.connection.response.headers["X-Shopify-Shop-Api-Call-Limit"]

However, I also saw on another thread that there is also an API Key Global limit that should be accessible somewhere through: 'x-shopify-api-call-limit' 但是,我还在另一个线程上看到,还有一个API密钥全局限制,该限制可以通过以下方式访问: 'x-shopify-api-call-limit'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM