Posted at 2011-11-25 01:37:19 under テクノロジ (by key)

Affiliate Window API のサンプルコードがPHP版しかないのでPythonで何とかしてみたメモ。まだまだ調査中。

import suds
url = 'http://v3.core.com.productserve.com/ProductServeService.wsdl'

client = suds.client.Client(url)
userauth = client.factory.create('UserAuthentication')
userauth.sApiKey = 'あーぶらかたぶらー'

client.set_options(soapheaders=userauth)
client.service.getCategoryTree()

結果。

(CategoryTree){
  oCategory[] =
     (Category){
        iId = 97
        sName = "Clothing & Accessories"
        sDescription = "Clothing & Accessories"
        iAdult = 0
     },
     (Category){
        iId = 61
        sName = "Computers & Software"
        sDescription = "Computers & Software"
        iAdult = 0
     },
     (Category){
        iId = 4
        sName = "Electronics"
        sDescription = "Electronics"
        iAdult = 0
     },
     (Category){
        iId = 634
        sName = "Entertainment"
        sDescription = "Entertainment"
        iAdult = 0
     },
     (Category){
        iId = 173
        sName = "Gifts, Gadgets & Toys"
        sDescription = "Gifts, Gadgets & Toys"
        iAdult = 0
     },
     (Category){
        iId = 99
        sName = "Health & Beauty"
        sDescription = "Health & Beauty"
        iAdult = 0
     },
     (Category){
        iId = 421
        sName = "Home & Garden"
        sDescription = "Home & Garden"
        iAdult = 0
     },
     (Category){
        iId = 361
        sName = "Home Appliances"
        sDescription = "Home Appliances"
        iAdult = 0
     },
     (Category){
        iId = 540
        sName = "Jewellery"
        sDescription = "Jewellery"
        iAdult = 0
     },
     (Category){
        iId = 246
        sName = "Sports"
        sDescription = "Sports"
        iAdult = 0
     },
     (Category){
        iId = 347
        sName = "Telephones & Faxes"
        sDescription = "Telephones & Faxes"
        iAdult = 0
     },
     (Category){
        iId = 586
        sName = "Tickets"
        sDescription = "Tickets"
        iAdult = 0
     },
     (Category){
        iId = 328
        sName = "Travel"
        sDescription = "Travel"
        iAdult = 0
     },
     (Category){
        iId = 493
        sName = "Vehicles, Parts and Accessories"
        sDescription = "Vehicles, Parts & Accessories"
        iAdult = 0
     },
}

Tags: python
blog comments powered by Disqus