I'm currently working on a Golang website (running on Ubuntu) that will update a twitter status. I used twurl customer key authentication on the system and I can successfully update the status if I type directly into the linux terminal. For example
- ssh/putty into target system
- type in terminal: twurl -d 'status=is this thing on' /1.1/statuses/update.json
- twitter status successfully updated
When I try to do the same through Golang exec, twitter gives me an authentication error.
func UpdateMainStatus(status string) {
statusarg := `'` + "status=" + status + `'`
out, err := exec.Command("twurl", "-d", statusarg, "/1.1/statuses/update.json").Output()
}
I've tried a couple of different methods for formatting the statusarg. Printing the above statusarg to the console shows: 'status=Windows worked, Testing update on ubuntu.'
Twurl does seem to be run as out shows an error response from twitter, {"code":32,"message":"Could not authenticate you."}. I suspect it has to do with the setup of the command...??? Or maybe the interpretation of the single quotes in the status argument???