Skip to content

Commit d13c061

Browse files
author
Sharoon Thomas
committed
Merge pull request fulfilio#5 from openlabs/goodscloud-merge
The original pull request fulfilio#4 was refactored and commits were reorganized to have a cleaner history. Thanks to @goodscloud for collecting improvements from different forks
2 parents a25dcbd + a7e0f8f commit d13c061

File tree

8 files changed

+262
-67
lines changed

8 files changed

+262
-67
lines changed

README.rst

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
Magento Python API
2+
==================
3+
4+
Python library to connect to Magento Webservices.
5+
6+
Check documentation source code
7+
8+
Usage
9+
-----
10+
11+
.. code-block:: python
12+
13+
import magento
14+
15+
url = 'http://domain.com/'
16+
apiuser = 'user'
17+
apipass = 'password'
18+
19+
with magento.Product(url, apiuser, apipass) as product_api:
20+
order_filter = {'created_at':{'from':'2011-09-15 00:00:00'}}
21+
products = product_api.list(order_filter)
22+
23+
with magento.ProductTypes(url, apiuser, apipass) as product_type_api:
24+
product_type = product_type_api.list()
25+
26+
with magento.Product(url, apiuser, apipass) as product_api:
27+
sku = 'prod1'
28+
product = product_api.info(sku)
29+
30+
with magento.API(url, apiuser, apipass) as magento_api:
31+
# Calling custom APIs if you have extension modules on your
32+
# magento installation
33+
websites = magento_api.call('ol_websites.list', [])
34+
store_group = magento_api.call('ol_groups.list', [])
35+
store_views = magento_api.call('ol_storeviews.list', [])
36+
37+
with magento.Order(url, apiuser, apipass) as order_api:
38+
order_increment_id = '100000001 '
39+
status = 'canceled'
40+
order_api.addcomment(order_increment_id, status)
41+
42+
43+
License
44+
-------
45+
46+
GNU Affero General Public License version 3
47+
48+
See LICENSE for more details

magento/__init__.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
'Country', 'Region',
1515
'Category', 'CategoryAttribute', 'Product', 'ProductAttribute',
1616
'ProductAttributeSet', 'ProductTypes', 'ProductImages',
17-
'ProductTierPrice', 'ProductLinks', 'Inventory',
18-
'Order', 'Shipment', 'Invoice',
17+
'ProductTierPrice', 'ProductLinks', 'ProductConfigurable',
18+
'Inventory', 'Order', 'Shipment', 'Invoice',
1919
]
2020

21-
from api import API
22-
from customer import Customer, CustomerGroup, CustomerAddress
23-
from directory import Country, Region
24-
from catalog import Category, CategoryAttribute
25-
from catalog import Product, ProductAttribute, ProductAttributeSet
26-
from catalog import ProductTypes, ProductImages, ProductTierPrice
27-
from catalog import ProductLinks, Inventory
28-
from sales import Order, Shipment, Invoice
21+
from .api import API
22+
from .customer import Customer, CustomerGroup, CustomerAddress
23+
from .directory import Country, Region
24+
from .catalog import Category, CategoryAttribute
25+
from .catalog import Product, ProductAttribute, ProductAttributeSet
26+
from .catalog import ProductTypes, ProductImages, ProductTierPrice
27+
from .catalog import ProductLinks, ProductConfigurable, Inventory
28+
from .sales import Order, Shipment, Invoice

magento/api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,11 @@ def call(self, resource_path, arguments):
163163
return self.client.service.call(
164164
self.session, resource_path, arguments)
165165

166-
def multiCall(self, calls, options):
166+
def multiCall(self, calls):
167167
"""
168168
Proxy for multicalls
169169
"""
170170
if self.protocol == 'xmlrpc':
171-
return self.client.multiCall(self.session, calls, options)
171+
return self.client.multiCall(self.session, calls)
172172
else:
173-
return self.client.service.multiCall(self.session, calls, options)
173+
return self.client.service.multiCall(self.session, calls)

0 commit comments

Comments
 (0)