gpt4 book ai didi

c++ - 从 twitcurl timelineUserGet 方法获取未授权错误

转载 作者:行者123 更新时间:2023-11-28 08:06:26 29 4
gpt4 key购买 nike

我目前正在使用 twitcurl 在 Linux 和 Twitter 上使用 C++。我已经构建了 twitcurl,它似乎可以正常工作,我已经能够从他们项目中的 twitterClient 示例的稍微定制的版本中发推文。但是,我一直在努力阅读用户的时间表。

现在,我知道通用身份验证正在工作,因为我设法首先以正确的用户身份发送推文。

但是,当我尝试使用以下代码读取用户时间线时:

/* Get user timeline */
replyMsg = "";
printf( "\nGetting user timeline\n" );
if( twitterObj.timelineUserGet( true, false, 5 ) )
{
twitterObj.getLastWebResponse( replyMsg );
printf( "\ntwitterClient:: twitCurl::timelineUserGet web response:\n%s\n", replyMsg.c_str() );
}
else
{
twitterObj.getLastCurlError( replyMsg );
printf( "\ntwitterClient:: twitCurl::timelineUserGet error:\n%s\n", replyMsg.c_str() );
}

我收到以下错误:

twitterClient:: twitCurl::timelineUserGet web response:
<?xml version="1.0" encoding="UTF-8"?><hash><request>/1/statuses/user_timeline.xml? count=5?trim_user=1</request><error>Not authorized</error></hash>

我不确定这是否与 twitcurl 使用 multiple 生成的无效 url 有关?可能与身份验证冲突的符号。

完整的源代码可以在 https://github.com/paulspencerwilliams/CPlusPlusSocialPlayground/blob/master/twitterClient.cpp 找到.

最佳答案

The following post helped me to solve the same problem

What steps will reproduce the problem?

Sending certain characters to twitter API (Any character that has to be percent encoding, except the blank space?).

What is the expected output? What do you see instead?

I'd expect twitter's server to accept my oauth signature but it hits me in the face instead.

What version of the product are you using? On what operating system?

r88, this problem applies to both linux and wii (through devkitpro)

Please provide any additional information below.

The problem can be fixed by removing the urlencode() calls within buildOAuthRawDataKeyValPairs() in oauth.cpp.

That is according to how twitter says we have to do it. I don't know (did not check) if that's how the oauth spec says it should be done but it is clearly how it works with twitter.

Did you write oauthlib.cpp?

关于c++ - 从 twitcurl timelineUserGet 方法获取未授权错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10214279/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com