淘宝 Open API Python SDK

最近需要在 django 上跑淘宝的 open API ,所以封装了一些常用的API。
使用说明:
    修改sercetCode与api_key可以去base.py里找。(为了方便说明,我已经注册了一个)
    用的是淘宝 Open API 2.0 版本。
    返回的数据只做了json处理,XML还没有做。(需要安装 simplejson库)
    有两个方法:
      setParams
      setFields
下载地址: http://code.google.com/p/python-taobao-open-sdk2/


例子:
普通用法:

from taobaoapi2 imoprt * 
 
itemsget = ItemsGet() 
itemsget.setParams(nicks='etanliuyang') 
itemsget.fetch() 
for x in itemsget.datas: 
  print x['title']



错误信息处理:

from taobaoapi2 imoprt * 
 
itemsget = ItemsGet() 
itemsget.setParams(nicks='v') 
itemsget.fetch() 
if itemsget.error_msg: print itemsget.error_msg

你可能感兴趣的:(json,xml,django,python,Google)