예제 #1
0
def get_taobao_cates(top, expire=600.0):
    request = TOPRequest('taobao.topats.itemcats.get')
    #request['cids'] = 0
    #request['output_format'] = 'json'
    #request['type'] = 1
    taobao_result = try_execute(top, request, expire)
    #request['type'] = 2
    #tmall_result = try_execute(top, request, expire)
    print taobao_result
예제 #2
0
def get_taobao_shops(top, nickname, expire=600):
    request = TOPRequest('taobao.shop.get')
    if type(nickname) is unicode:
        nickname = nickname.encode('utf-8')
    request['nick'] = nickname
    request[
        'fields'] = 'sid,cid,nick,title,desc,pic_path,created,modified,shop_score'
    results = try_execute(top, request, expire)
    return results
예제 #3
0
def get_report(top, date, session, pageno=1, pagesize=40, expire=600):
    # TODO: session support
    request = TOPRequest('taobao.taobaoke.report.get')
    request['session'] = session
    request[
        'fields'] = 'commission_rate,real_pay_fee,app_key,outer_code,trade_id,pay_time,pay_price,num_iid,item_title,item_num,category_id,category_name,shop_title,commission,iid,seller_nick,create_time,confirm_time'
    request['date'] = date
    request['page_no'] = pageno
    request['page_size'] = pagesize
    return try_execute(top, request, expire)
예제 #4
0
def get_spmeffect_trade(top,
                        datestr,
                        page_detail=False,
                        module_detail=False,
                        expire=600.0):
    request = TOPRequest('taobao.spmeffect.get')
    request['date'] = datestr
    request['page_detail'] = page_detail
    request['module_detail'] = module_detail
    taobao_result = try_execute(top, request, expire)
    return taobao_result
예제 #5
0
def get_taobao_items(top,
                     items,
                     fn_join_iids=lambda x: ','.join(x),
                     batch_size=20,
                     calllimit=60,
                     expire=600):
    request = TOPRequest('taobao.items.list.get')
    for chunk in waitlimit(calllimit, 60.0,
                           batch(items, batch_size)):  # calllimit for minutes
        chunk = list(chunk)
        request[
            'fields'] = "detail_url,cid,num_iid,title,nick,pic_url,num,price,has_showcase,approve_status,list_time,delist_time,modified,stuff_status,is_timing,post_fee,express_fee,ems_fee, has_discount,freight_payer"
        request['num_iids'] = fn_join_iids(chunk)
        results = try_execute(top, request, expire)
        #logger.debug('Calling %s(%s) -> %s', request.method_name, request.api_params, results)
        yield TopRequests(chunk, results)
예제 #6
0
def get_deleted_items(top,
                      items,
                      fn_join_iids=lambda x: ','.join(map(str, x)),
                      batch_size=20,
                      calllimit=60,
                      expire=600):
    request = TOPRequest('taobao.items.list.get')
    for chunk in waitlimit(calllimit, 60.0, batch(items, batch_size)):
        chunk = list(chunk)
        request['fields'] = "num_iid,approve_status"
        request['num_iids'] = fn_join_iids(chunk)
        results = try_execute(top, request, expire)
        logger.debug('Calling %s(%s) -> %s', request.method_name,
                     request.api_params, results)
        try:
            # TODO: request may not show in result
            for item in results['items']['item']:
                if item['approve_status'] != 'onsale':
                    yield item
        except:
            logger.warn("get_deleted_items %s", traceback.format_exc())
예제 #7
0
def get_taobao_trade(top, trade_id, expire=600.0):
    request = TOPRequest('taobao.trade.get')
    request['fields'] = 'buyer_rate'
    taobao_result = try_execute(top, request, expire)
    print taobao_result
예제 #8
0
def get_taobao_itemcats(top, cid, expire=600.0):
    request = TOPRequest('taobao.itemcats.get')
    request['cids'] = cid
    request['fields'] = 'cid,parent_cid,name,is_parent'
    return try_execute(top, request, expire)
예제 #9
0
def get_promotion_info(top, itemid, expire=600.0):
    request = TOPRequest('taobao.ump.promotion.get')
    request['item_id'] = itemid
    return try_execute(
        top, request, expire
    )  # ump_promotion_get_response:promotions:promotion_in_item/shop --> list[desc/name]
예제 #10
0
def get_taobao_shops(top, nicks, expire=600):
    request = TOPRequest('taobao.tbk.shops.detail.get')
    request['seller_nicks'] = nicks  # array
    request['fields'] = 'user_id,seller_nick,shop_title,pic_url,shop_url'
    results = try_execute(top, request, expire)
    return results