Skip to content

Commit

Permalink
Merge pull request #5 from openlabs/goodscloud-merge
Browse files Browse the repository at this point in the history
The original pull request #4 was refactored and commits were reorganized to have a cleaner history.

Thanks to @goodscloud for collecting improvements from different forks
  • Loading branch information
Sharoon Thomas committed Apr 25, 2013
2 parents a25dcbd + a7e0f8f commit d13c061
Show file tree
Hide file tree
Showing 8 changed files with 262 additions and 67 deletions.
48 changes: 48 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
Magento Python API
==================

Python library to connect to Magento Webservices.

Check documentation source code

Usage
-----

.. code-block:: python
import magento
url = 'http://domain.com/'
apiuser = 'user'
apipass = 'password'
with magento.Product(url, apiuser, apipass) as product_api:
order_filter = {'created_at':{'from':'2011-09-15 00:00:00'}}
products = product_api.list(order_filter)
with magento.ProductTypes(url, apiuser, apipass) as product_type_api:
product_type = product_type_api.list()
with magento.Product(url, apiuser, apipass) as product_api:
sku = 'prod1'
product = product_api.info(sku)
with magento.API(url, apiuser, apipass) as magento_api:
# Calling custom APIs if you have extension modules on your
# magento installation
websites = magento_api.call('ol_websites.list', [])
store_group = magento_api.call('ol_groups.list', [])
store_views = magento_api.call('ol_storeviews.list', [])
with magento.Order(url, apiuser, apipass) as order_api:
order_increment_id = '100000001 '
status = 'canceled'
order_api.addcomment(order_increment_id, status)
License
-------

GNU Affero General Public License version 3

See LICENSE for more details
20 changes: 10 additions & 10 deletions magento/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
'Country', 'Region',
'Category', 'CategoryAttribute', 'Product', 'ProductAttribute',
'ProductAttributeSet', 'ProductTypes', 'ProductImages',
'ProductTierPrice', 'ProductLinks', 'Inventory',
'Order', 'Shipment', 'Invoice',
'ProductTierPrice', 'ProductLinks', 'ProductConfigurable',
'Inventory', 'Order', 'Shipment', 'Invoice',
]

from api import API
from customer import Customer, CustomerGroup, CustomerAddress
from directory import Country, Region
from catalog import Category, CategoryAttribute
from catalog import Product, ProductAttribute, ProductAttributeSet
from catalog import ProductTypes, ProductImages, ProductTierPrice
from catalog import ProductLinks, Inventory
from sales import Order, Shipment, Invoice
from .api import API
from .customer import Customer, CustomerGroup, CustomerAddress
from .directory import Country, Region
from .catalog import Category, CategoryAttribute
from .catalog import Product, ProductAttribute, ProductAttributeSet
from .catalog import ProductTypes, ProductImages, ProductTierPrice
from .catalog import ProductLinks, ProductConfigurable, Inventory
from .sales import Order, Shipment, Invoice
6 changes: 3 additions & 3 deletions magento/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,11 @@ def call(self, resource_path, arguments):
return self.client.service.call(
self.session, resource_path, arguments)

def multiCall(self, calls, options):
def multiCall(self, calls):
"""
Proxy for multicalls
"""
if self.protocol == 'xmlrpc':
return self.client.multiCall(self.session, calls, options)
return self.client.multiCall(self.session, calls)
else:
return self.client.service.multiCall(self.session, calls, options)
return self.client.service.multiCall(self.session, calls)
Loading

0 comments on commit d13c061

Please sign in to comment.