Re: [go-nuts] Re: Looking for Golang counterpart to 'params' in Python

2016-12-13 Thread Justin Israel
On Wed, Dec 14, 2016 at 11:39 AM Betsy Lichtenberg wrote: > Interesting. Thanks for the idea, but for security reasons I'm not sure if > it's something we can do. For some background, the reason I started down > this road is we cannot include the auth parameter in the request URL. > I was actual

Re: [go-nuts] Re: Looking for Golang counterpart to 'params' in Python

2016-12-13 Thread Betsy Lichtenberg
For what it's worth, a friend of mine advised me to use maps. https://blog.golang.org/go-maps-in-action But, alas, I'm not enough of a guru to do anything fancy. On Tue, Dec 13, 2016 at 2:16 PM, Justin

Re: [go-nuts] Re: Looking for Golang counterpart to 'params' in Python

2016-12-13 Thread Betsy Lichtenberg
Interesting. Thanks for the idea, but for security reasons I'm not sure if it's something we can do. For some background, the reason I started down this road is we cannot include the auth parameter in the request URL. https://developer-api.nest.com/structures?auth=x http://self-issued.info/d

Re: [go-nuts] Re: Looking for Golang counterpart to 'params' in Python

2016-12-13 Thread Justin Israel
Hi, While others have been talking about headers, I notice that you are using the python requests 3rd party library, and referring to the "params" keyword arg which is meant to pass query string values in your GET request. I would think the equivalent in Go would be to: 1. Build the equivale

Re: [go-nuts] Re: Looking for Golang counterpart to 'params' in Python

2016-12-13 Thread 'Chris Manghane' via golang-nuts
I see, well that makes the compiler error make more sense. You're trying to declare a function type within a function. Use a function literal instead, for example: `doIT := func(p Params) string { ... }`. On Tue, Dec 13, 2016 at 11:18 AM, Betsy Lichtenberg wrote: > The expression is inside of th

Re: [go-nuts] Re: Looking for Golang counterpart to 'params' in Python

2016-12-13 Thread Betsy Lichtenberg
The expression is inside of the main function. package main import ( "fmt" "strings" "net/http" "io/ioutil" ) func main() { url := "https://developer-api.nest.com/structures"; payload := strings.NewReader("code=a&client_id=&client_secret=&grant_type=authorization_code") req, _ :=

Re: [go-nuts] Re: Looking for Golang counterpart to 'params' in Python

2016-12-13 Thread 'Chris Manghane' via golang-nuts
That error seems to be from writing that expression outside of a function. There's no problem with structs supporting string fields: https://play.golang.org/p/YeP2qhRdxp. On Tue, Dec 13, 2016 at 10:45 AM, Betsy Lichtenberg wrote: > Do structs support strings? I tried this: > > type Params st