opentaobao

package module
v0.0.0-...-a7b67dc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 26, 2020 License: MIT Imports: 11 Imported by: 0

README

taobaogo

淘宝Api、淘宝开放平台Api请求基础SDK

项目迁移至 https://github.com/nilorg/go-opentaobao

淘宝API sign算法

sign算法

Example 🌰

package main

import (
	"fmt"

	 "github.com/dkeng/opentaobao-go"
)

func init() {
	opentaobao.AppKey = ""
	opentaobao.AppSecret = ""
	opentaobao.Router = "http://gw.api.taobao.com/router/rest"
}

func main() {
	res, err := opentaobao.Execute("taobao.tbk.item.get", opentaobao.Parameter{
		"fields": "num_iid,title,pict_url,small_images,reserve_price,zk_final_price,user_type,provcity,item_url,seller_id,volume,nick",
		"q":      "女装",
		"cat":    "16,18",
	})

	if err != nil {
		fmt.Println(err)
	}

	fmt.Println("商品数量:", res.Get("tbk_item_get_response").Get("total_results").MustInt())
	var imtes []interface{}
	imtes, _ = res.Get("tbk_item_get_response").Get("results").Get("n_tbk_item").Array()
	for _, v := range imtes {
		fmt.Println("======")
		item := v.(map[string]interface{})
		fmt.Println("商品名称:", item["title"])
		fmt.Println("商品价格:", item["reserve_price"])
		fmt.Println("商品链接:", item["item_url"])
	}
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// AppKey 应用Key
	AppKey string
	// AppSecret 秘密
	AppSecret string
	// Router 环境请求地址
	Router string
	// Timeout ...
	Timeout time.Duration
)

Functions

func Execute

func Execute(method string, param Parameter) (res []byte, err error)

Execute 执行API接口

Types

type Parameter

type Parameter map[string]interface{}

Parameter 参数 参数的值 如果是 多个,用字符串逗号隔开

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL