`
shupili141005
  • 浏览: 119289 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类

Taobao.items.search

阅读更多

http://open.taobao.com/dev/index.php/API2.0:Taobao.items.search

 

TucueClientUtil.cs 文件:

using System;
using System.Collections.Generic;

using System.Text;
using System.Configuration;
using System.IO;
using System.Text.RegularExpressions;
using Tucue.Top.Api.Util;
using System.Diagnostics;
using System.Net;

namespace Tucue.Top.Api
{
    public class TucueClientUtil
    {
        public static ITucueClient GetSandboxTopClient()
        {
            GetAppkeyScret();
            return new TucueRestClient("http://gw.api.taobao.com/router/rest?", appKey, appSecret);
        }

        public static ITucueClient GetProductTopClient()
        {
            GetAppkeyScret();
            return new TucueRestClient("http://gw.api.taobao.com/router/rest?", appKey, appSecret,"xml");
        }

        private static void GetAppkeyScret()
        {
            try
            {
                appKey = ConfigurationManager.AppSettings["appKey"].ToString();
                appSecret = ConfigurationManager.AppSettings["appSecret"].ToString();
            }
            catch (Exception e)
            {
                Trace.WriteLine(e.Message.ToString());
            }
        }

        /// <summary>
        /// 获取测试环境下的用户会话授权码。
        /// </summary>
        /// <param name="nick">用户昵称</param>
        /// <returns>用户会话授权码</returns>
        public static string GetSandboxSessionKey(string nick)
        {
            IDictionary<string, string> authCodeParams = new Dictionary<string, string>();
            authCodeParams.Add("appkey", "sns");
            authCodeParams.Add("nick", nick);

            string authCodeRsp = WebUtils.DoPost(TOP_AUTHORIZE_URL, authCodeParams);
            string authCodePattern = "<input type=\"text\" id=\"autoInput\" value=\"(.+?)\" style=\".+?\">";
            Match authCodeResult = Regex.Match(authCodeRsp, authCodePattern);
            string authCode = authCodeResult.Groups[1].Value;

            IDictionary<string, string> sessionParams = new Dictionary<string, string>();
            sessionParams.Add("authcode", Uri.UnescapeDataString(authCode));
            string sessionRsp = WebUtils.DoGet(TOP_CONTAINER_URL, sessionParams);

            string sessionPattern = "&top_session=(\\w+?)&";
            Match sessionResult = Regex.Match(sessionRsp, sessionPattern);
            string sessionKey = sessionResult.Groups[1].Value;

            return sessionKey;
        }

        private static string appKey = "12008052";
        private static string appSecret = "5de0727f2d66808ebe481c2b31705e02";
        private const string TOP_AUTHORIZE_URL = "http://open.taobao.com/isv/authorize.php";
        private const string TOP_CONTAINER_URL = "http://container.sandbox.taobao.com/container";
    }
}

分享到:
评论

相关推荐

    淘宝 2.0 API [ taobao.items.search item.get increment.items.get] Java 调用示例

    NULL 博文链接:https://douglee.iteye.com/blog/687439

    SCJP-Items.pdf

    SCJP-TestReal.Items.pdfSCJP-TestReal.Items.pdfSCJP-TestReal.Items.pdfSCJP-TestReal.Items.pdfSCJP-TestReal.Items.pdfSCJP-TestReal.Items.pdfSCJP-TestReal.Items.pdfSCJP-TestReal.Items.pdfSCJP-TestReal....

    Asp.net 调用淘宝客Top Api接口实例源码 v1.0 Beta.rar

    //返回DataSet taobao.taobaoke.items.get:接口 //TaoBaokeObject //返回数组taobao.taobaoke.items.get:接口 //TaoBaokeObjects //返回数组taobao.taobaoke.items.get:接口 //TaoBaokes //返回DataSet ...

    Asp.net 调用淘宝客Top Api 接口 实例源码!

    //返回DataSet taobao.taobaoke.items.get:接口 //TaoBaokeObject //返回数组taobao.taobaoke.items.get:接口 //TaoBaokeObjects //返回数组taobao.taobaoke.items.get:接口 //TaoBaokes //返回DataSet ...

    OCJP-TestReal[1]讲解.310-065.244.Items

    OCJP-TestReal[1]讲解.310-065.244.Items

    测试listBox1.Items.Remove是用ToString还是利用gethashCode来定位元素的

    测试listBox1.Items.Remove是用ToString还是利用gethashCode来定位元素的

    221025-14Linkage(HttpContext.Items数据读写)

    1 猜测 本人一直想不明白nopCommerce开发者花费大力气、大代价,定义实现1个实现极为精巧,数据存储极为短暂且容易被销毁(通过HttpContext?.Items对实体实例进存储)

    asp.net中dropdownlist控件的简单应用

    this.DropDownList2.Items.Clear(); this.DropDownList2.Items.Add("南阳市"); this.DropDownList2.Items.Add("信阳市"); this.DropDownList2.Items.Add("郑州市"); this.DropDownList2.Items.Add("周口市"); ...

    ListBox实现双向选择

    i &lt; this.LB1.Items.Count; i++) { if (LB1.Items[i].Selected == true) { //Menu menu = (Menu)this.LB1.Items[i]; //this.LB2.Items.Add(menu); ListItem item = new ListItem(); item = this.LB1.Items[i...

    学学Python_字典13_字典的方法(items、pop)

    items和pop方法,文章:https://blog.csdn.net/yysyangyangyangshan/article/details/82947624

    Delphi控件大全.doc

    重要属性items.* 举例,界面设计如下左,执行结果如下右: 代码为 procedure TForm1.Button1Click(Sender: TObject); begin edit1.Text := listbox1.Items.CommaText; edit2.Text := listbox1.Items.Text; edit3....

    最新淘宝客程序下载-具体看演示,程序无后门

    最新方式taobao.taobaoke.items.detail.get 调用得到商品的num_iid, 然后调用taobao.taobaoke.items.detail.get来获取商品详情数据 多的不说了 具体看演示,程序无后门。。。大家可以放心使用。 演示地址 ...

    Delphi 修改内存保护属性.rar

     ListBox1.Items.Add('基地址: ' IntToHex(Longint(MemInfo.BaseAddress),8));  ListBox1.Items.Add('分配地址: ' IntToHex(Longint(  MemInfo.AllocationBase),8));  ListBox1.Items.Add('区域大小: ' IntToStr...

    C#域名解析

    listBoxLocalInfo.Items.Add("IP端点:" + iep.ToString()); listBoxLocalInfo.Items.Add("IP端口:" + iep.Port); listBoxLocalInfo.Items.Add("IP地址:" + iep.Address); listBoxLocalInfo.Items.Add("IP地址...

    C# Ping的例子,可用于测试网络,延迟xx毫秒。

    lst_PingResult.Items.Add("答复的主机地址:" + reply.Address.ToString()); lst_PingResult.Items.Add("往返时间:" + reply.RoundtripTime); lst_PingResult.Items.Add("生存时间(TTL):" + reply.Options....

    C实现的关联规则算法

    this.TDataView.Items.RemoveAt(this.TDataView.SelectedIndex); } private void Next_Click(object sender, EventArgs e) { if (finish == true) { this.Next.Text = "计算下一步"; Reset(); return; }...

    Delphi 获取Win进程列表范例.rar

     Listbox2.Items.add('模块名称:' ModuleArray[i].szModule);  Listbox2.items.add('模块ID:' IntToStr(ModuleArray[i].th32ModuleID));  Listbox2.items.add('所属进程ID:' IntToStr(ModuleArray[i].th32Process...

    《python基础教程》答案(第七章).pdf

    《python基础教程》答案(第七章) 《python基础教程》答案(第七章) Fridge.py # created by swy """ solutions to beginning python """ class Fridge: def __init__(self, items={}): """ Optionally pass in an...

    listview基本用法

    // listview1.Items[Listview1.Items.Count -1].MakeVisible(True); procedure TForm1.Button2Click(Sender: TObject); // 选择第一条 begin listview1.SetFocus; listview1.Items[0].Selected := True; end; ...

    c#做的简单通讯录

    listView1.Items.Add(item); } //保存 public void save() { FileStream fs = new FileStream(@"通讯录.txt", FileMode.Create, FileAccess.Write); StreamWriter sw = new StreamWriter(fs, Encoding....

Global site tag (gtag.js) - Google Analytics