我目前正在Golang网站(在Ubuntu上运行)上工作,该网站将更新Twitter状态。我在系统上使用了twurl客户密钥认证,如果直接在linux终端中键入,则可以成功更新状态。例如
[当我尝试通过Golang exec执行相同操作时,twitter给了我一个验证错误。
func UpdateMainStatus(status string) {
statusarg := `'` + "status=" + status + `'`
out, err := exec.Command("twurl", "-d", statusarg, "/1.1/statuses/update.json").Output()
}
我尝试了几种不同的格式化statusarg的方法。将上述statusarg打印到控制台显示:“ status = Windows运行,正在Ubuntu上测试更新。”
Twurl似乎没有运行,因为显示了Twitter的错误响应,{“代码”:32,“消息”:“无法验证您的身份。”}。我怀疑这与命令的设置有关... ???或者也许是状态参数中单引号的解释????
我目前正在Golang网站(在Ubuntu上运行)上工作,该网站将更新Twitter状态。我在系统上使用了twurl客户密钥身份验证,如果我...
不包括单引号: