0

Using this for fetching data from My Magento website. The catalog product API is working fine. It returns all the products. But when I try to fetch attribute using the following command it returns an empty list.

>>> magento = MagentoAPI("magentohost,com","80","**","**","/api/xmlrpc")
>>> products = magento.catalog_product.list()
>>> len(products)
3345
>>> attrs = magento.catalog_product_attribute.list()
>>> attrs
[]

I have lot of products attributes in my catalog. Why does it return empty then?

P.S: Is the JSON Magento API better than XML API ?

asked Sep 6, 2015 at 18:25

1 Answer 1

1

I am using Python xmlrpc to manage my magento store this two days, Very good but there are little document about python+xmlrpc. I do not use MagentoAPI or Other third-party lib, I am worry that the library do not update.

import timeit
import xmlrpclib
import datetime
from pyexcel_ods import get_data
import json
client = None
session = None
user = 'username'
password = 'password'
def setup():
 global client, session
 # your domain here
 client = xmlrpclib.ServerProxy("http://www.magentohost.com.hk/index.php/api/xmlrpc?type=xmlrpc")
 # your credentials here
 session = client.login('username', 'password')
setup()
attribute_sets = client.call(session, 'catalog_product_attribute_set.list')
print attribute_sets
print "\n\n"
# show list all attribute of frist one set 
attributes = client.call(session, 'catalog_product_attribute.list',[attribute_sets[0]['set_id']])
print attributes

This is my frist time to answer stackexchange question.

answered Dec 5, 2015 at 11:32

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.