All Projects → nilorg → go-opentaobao

nilorg / go-opentaobao

Licence: MIT license
🎉淘宝Api、淘宝开放平台Api请求基础SDK

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to go-opentaobao

node-topsdk
Taobao top sdk
Stars: ✭ 26 (-52.73%)
Mutual labels:  taobao-sdk
opentaobao-go
🎉淘宝Api、淘宝开放平台Api请求基础SDK
Stars: ✭ 12 (-78.18%)
Mutual labels:  taobao-sdk

taobaogo

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

淘宝API

sign算法

淘宝Session

Example 🌰

package main

import (
	"fmt"

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

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"])
	}
}

使用Redis作为缓存

import "github.com/go-redis/redis/v8"

var (
	// Redis 缓存
	Redis *redis.Client
)

func init() {
	opentaobao.SetRedis(Redis)
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].