troubleshooting: how to connect to Magento API from Python?

Created by Raphaƫl Valyi - on on 2011-02-22
xmlrpc api

open a python console:
>>> import xmlrpclib
>>> socket = xmlrpclib.ServerProxy(magento_url + "/index.php/api/xmlrpc")
>>> session = socket.login(api_username, api_password)

how to retrieve a list of Magento oders?

>>>, "sales_order.list", [{'state': {'neq': 'canceled'}, 'store_id': {'eq': 10}, 'increment_id': {'to': 1000000446, 'from': 1000000247}}])

replace your from/to increment_id by what you want and find out the store_id you need, you can look at the ir_model_data table in OpenERP to find out which store_id is associated to which OpenERP shop.

how to get the detail of one sale order?

>>>, "", ['1000000247'])

how to get the detail of one customer?

>>>, "", ['7796'])


Read Magento API detail: