geduldig / TwitterAPI

Minimal python wrapper for Twitter's REST and Streaming APIs
938 stars 263 forks source link

Not sure where to ask this and can’t figure it out. How to test login w/o sending tweet? #130

Closed mwoolweaver closed 4 years ago

mwoolweaver commented 4 years ago

I have been searching for the way to validate credentials using TwitterAPI and I can’t figure it out for life of me. So I was wondering if you could help me out?

How to test login w/o sending tweet?

geduldig commented 4 years ago

You would make a request for account/verify_credentials. It will return account information documented at https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-account-verify_credentials.

However, I don't think it will tell you if your credentials will allow you to tweet

mwoolweaver commented 4 years ago

So this

r = api.request('account/verify_credentials')

And then parse r as json?

geduldig commented 4 years ago

That's right. The returned value r will be a JSON structure as outlined in the sited doc.

mwoolweaver commented 4 years ago

Thank you for your help!! Would’ve been a while before I got that on my own.