Python API


#1

Hi, two part question.

  1. Are there any API docs for python?
  2. In the getting started guide the code to add item throws an ‘invalid syntax’ error

cart.add_item({
‘id’: product_id
‘quantity’: 1,
})

Any suggestions?

Thanks


#2

Hi!

Thanks for letting us know about the syntax error, this is an issue with that part of the documentation - it’s missing a comma after product_id.

cart.add_item({
    'id': product_id,
    'quantity': 1,
})

However, the Python SDK only supports V1 of our API, which is now deprecated. There is no official V2 SDK for Python, so I’d recommend looking at wrapping the cURL calls detailed at docs.moltin.com in something like requests (http://docs.python-requests.org/en/master/)

Hope this helps,
Craig


#3

Great - thanks for the quick response.