这是我正在尝试使用的课程
class Products(Resource):
"""The collection of products in a store"""
def get(self):
"""Returns list of products"""
products_list = self.client.request_json('GET', '/products?limit=%s&page=%s' % (self.paginate_by, self.current_page))
return [Product(product) for product in products_list]
这是我的脚本:
import bigcommerce.api
bigcommerce.api.Connection.host = 'https://store-qvek.mybigcommerce.com'
bigcommerce.api.Connection.user = 'admin'
bigcommerce.api.Connection.api_key = '272956b18e3a7c269b413385908cc7371f5c41'
products_list = bigcommerce.api.Products.get()
for product in products_list:
print product.name
我在 Products.get() 中遗漏了一些东西....但是什么?
Traceback (most recent call last):
File "C:\wget\bin\test_bigcommerce.py", line 8, in <module>
products_list = bigcommerce.api.Products.get()
TypeError: unbound method get() must be called with Products instance as first argument (got nothing instead)
PS 由于我更改了主机和 api 密钥以便将其公开发布,因此该代码将不起作用。