dongpan3001 2015-08-22 02:05
浏览 27

如何获取Cookie /会话信息,以便可以与API一起使用?

I'm trying to use this API:

https://developer.valvesoftware.com/wiki/Steam_Web_API/IEconService

But it basically requires me to have a session/cookies in place already so I need to basically make my Go program simulate a connection and Authenticate to steam following this format: https://github.com/SteamDatabase/SteamTracking/blob/master/API/ISteamUserAuth.json

But I'm not exactly sure how I can put this all together to get my Go program to login so that I can make calls to the logged in portion of the API. Thanks for any help sorry if this isn't very clear, if needing more information just ask.

  • 写回答

1条回答 默认 最新

  • douzhiba6873 2015-08-22 03:35
    关注

    Use a cookiejar to remember cookies.

    // make a client with a cookie jar
    client := &http.Client{Jar:cookiejar.New(nil)}
    // post to the auth url
    client.Post("...", "application/json", data)
    // with the same client make your request 
    client.Get("...")
    
    评论

报告相同问题?