Giter Site home page Giter Site logo

shopeego's Introduction

NO LONGER MAINTAINED (已暫停維護)

NOT RECOMMEND TO USE(暫不建議使用)

 

ShopeeGo GoDoc Coverage Status Build Status Go Report Card

Golang 所實作的 Shopee Open Platform API,包含所有 Shopee API v1 所提供的功能,這些功能都已經列舉在本專案的 Go Doc 之中。使用方式詳見 Shopee Open Platform Documentation

注意: Shopeego 是根據 Shopee 所提供的 API 文件與資料型態進行開發,但有些資料型態明顯是不正確的,這部份請參閱「參差不齊的官方文件」章節。

安裝方式

打開終端機並且透過 go get 安裝此套件即可。

$ go get gopkg.in/teacat/shopeego.v1

開始使用

透過 NewClient 並傳入你的 Partner 金鑰,如此一來就可以初始化一個 Shopee 客戶端。

// 初始化一個 Shopee 客戶端。
client := shopeego.NewClient(&shopeego.ClientOptions{
	Secret: "0c2c7b3bd59c2503f49a307fcf49dc985df43a1214821d5453e9ba54ca8e2e44",
})

// 取得指定商店的資料。
shop, _ := client.GetShopInfo(&shopeego.GetShopInfoRequest{
	PartnerID: 841237,
	ShopID:    307271,
	Timestamp: int(time.Now().Unix()),
})

fmt.Println(shop.ShopName) // 輸出:yamiodymel

參差不齊的官方文件

這個 API 套件在開發的時候發現了下列幾個問題。

這些問題你可能會在使用時遇到,當遇到 API 無法正常使用或是出現 error_param 時,請考慮到 Issue 中回報。

驗證介面

欲連接的賣場必須授權給你的 Shopee Open Platform 應用程式 才能夠與其對接。

簽署

這個套件仍然有幫你作這件事,但還是想讓你知道發生了什麼。應蝦皮官方要求所有的請求都必須簽署 HMAC-SHA256,很明顯這是有點神奇的蹦蹦安全手段(畢竟都已經有了 HTTPS)。如果你不明白,這裡舉個範例。

POST /api/v1/orders/detail HTTP/1.1
Host: partner.shopeemobile.com
Authorization: b37c061daf2fcfa2baffe7539110938be5b7525041c147e78ad8afa78cc1a72d

{"ordersn": "160726152598865", "shopid": 61299, "partner_id": 1, "timestamp": 1470198856}

在請求標頭的 Authorization 欄位中,這個雜湊碼來自於「請求網址|內容」並透過你的 API 金鑰作為祕密(Secret)演算而成。

shopeego's People

Contributors

hpcslag avatar pylist avatar yamiodymel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

shopeego's Issues

API Auth V2 SUPPORT

Hi there !

Do you have a plan to support API Auth V2?

Thanks you for your great works.

shopeego.GetOrderDetailsResponse.Orders接口报错

panic: shopeego.GetOrderDetailsResponse.Orders: []shopeego.GetOrderDetailsResponseOrder: shopeego.GetOrderDetailsResponseOrder.ActualShippingCost: readNumberAsString: invalid number, error found in #10 byte of ...|ng_cost":"","estimat|..., bigger context ...|ss":"24****************"},"actual_shipping_cost":""
,"estimated_shipping_fee":"120","escrow_tax":"0",|...

這個錯誤有時間方便修復一下

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.