Shopify Python API 请求 ISO 8601 格式
Shopify Python API Request ISO 8601 Fomat
Shopify API 参考说:
updated_at_min
Show products last updated after date (format: 2014-04-25T16:15:47-04:00)
如果我在进行 API 调用时有日期时间对象,我是否需要在发出请求之前将日期时间转换为 ISO 8601 格式的 string ?
即我需要这样做吗?
min_date = timezone.now()
shopify.Product.count(created_at_min = str(min_data.isoformat()))
那时我的请求将如下所示:
https://[store-url].myshopify.com/admin/products/count.json?updated_at_min=2017-01-29T14%3A43%3A27-05%3A00
与此对比(如果我传递 未格式化 日期时间对象):
https://[store-url].myshopify.com/admin/products/count.json?updated_at_min=2016-12-10+14%3A43%3A27-05%3A00
(如果是这样,为什么 Shopify Python API 不自动处理这个转换,看起来有点傻?)
(来自对我在 Shopify Python 存储库上的问题的回复):Shopify API 实际上确实接受多种日期格式,但使用API 文档 (ISO 8601),因为它保证在未来继续工作。
当前的 Shopify Python 模块当前不处理日期格式,因为该库的大部分功能是使用 pyactiveresource 包装 HTTP 请求 - 它主要是 https://github.com/shopify/shopify_api 的端口并且尚未扩展到执行此操作。
Shopify API 参考说:
updated_at_min
Show products last updated after date (format: 2014-04-25T16:15:47-04:00)
如果我在进行 API 调用时有日期时间对象,我是否需要在发出请求之前将日期时间转换为 ISO 8601 格式的 string ?
即我需要这样做吗?
min_date = timezone.now()
shopify.Product.count(created_at_min = str(min_data.isoformat()))
那时我的请求将如下所示:
https://[store-url].myshopify.com/admin/products/count.json?updated_at_min=2017-01-29T14%3A43%3A27-05%3A00
与此对比(如果我传递 未格式化 日期时间对象):
https://[store-url].myshopify.com/admin/products/count.json?updated_at_min=2016-12-10+14%3A43%3A27-05%3A00
(如果是这样,为什么 Shopify Python API 不自动处理这个转换,看起来有点傻?)
(来自对我在 Shopify Python 存储库上的问题的回复):Shopify API 实际上确实接受多种日期格式,但使用API 文档 (ISO 8601),因为它保证在未来继续工作。
当前的 Shopify Python 模块当前不处理日期格式,因为该库的大部分功能是使用 pyactiveresource 包装 HTTP 请求 - 它主要是 https://github.com/shopify/shopify_api 的端口并且尚未扩展到执行此操作。