Twitter REST change “from API” to something meanin

2020-02-14 03:18发布

When using simple request to post to Twitter the messages are signed with "sent from API". Is there a way to change that to the actual name of your application? Is it another post parameter or something else?

标签: rest twitter
4条回答
在下西门庆
2楼-- · 2020-02-14 03:46

If you want example on how to use OAuth and Twitter I have it in my blog

查看更多
Ridiculous、
3楼-- · 2020-02-14 04:00

"If you are writing a desktop Twitter client and you want your application's name to show up instead of "From API", you have to use OAUth. If you want to use OAuth in your desktop Twitter application, you have to go through Twitter's PIN workflow (i.e., sending the user to the Twitter website to authenticate)."

Hold on a moment, how do Twitter clients manage to put their client name in the "via" without you logging in somewhere and copying a PIN back to the application.

I just want a command line client that updates my status and prints "via MyApp". Am I missing something here? (I might be, I've only started trying to figure this out yesterday) In fact if the user isn't authenticated, I don't want to get them to login elsewhere and copy/paste a PIN, I want them to type their user/pass into my application. Like what happens with all the twitter clients I've seen...

查看更多
再贱就再见
4楼-- · 2020-02-14 04:09

This is covered in the Twitter API FAQ

If you would like tweets from your application to recieve a source parameter, please register an application and implement OAuth authentication. We will automatically include your application as the source for any tweets sent from your application.

查看更多
劳资没心,怎么记你
5楼-- · 2020-02-14 04:09

If you are writing a desktop Twitter client and you want your application's name to show up instead of "From API", you have to use OAUth.

If you want to use OAuth in your desktop Twitter application, you have to go through Twitter's PIN workflow (i.e., sending the user to the Twitter website to authenticate).

The confirmation step is part of the reason Twitter is using OAuth. There's no getting around it.

There are several libraries out there that implement OAuth for Twitter so you're not reinventing the wheel.

查看更多
登录 后发表回答