BenW94 / python-twitter

Automatically exported from code.google.com/p/python-twitter
Apache License 2.0
0 stars 0 forks source link

Getting {“errors”:[{“message”:“Bad Authentication data”,“code”:215}]} using python-twitter API v1.0 #252

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Twitter API v1.0 has been put to halt and only v1.1 is working. python-twitter 
v1.0 says that it works with Twitter API v1.1. On running the attached code, I 
am not able to retrieve any data. On opening one of the URLs, I get this error:

{“errors”:[{“message”:“Bad Authentication data”,“code”:215}]}

Original issue reported on code.google.com by ssr.digv...@gmail.com on 13 Jun 2013 at 9:03

Attachments:

GoogleCodeExporter commented 8 years ago
your attached code isn't running the python-twitter  code at all - am i missing 
something.

the python twitter Api class has a verify credentials helper routine to see if 
auth worked:

import twitter
api = twitter.Api(consumer_key='your key',
                      consumer_secret='your secret',
                      access_token_key='token key',
                      access_token_secret='token secret',
                      debugHTTP=False)

print api.VerifyCredentials()

Original comment by bear42 on 13 Jun 2013 at 10:43

GoogleCodeExporter commented 8 years ago
Yes. I am done with that step. I am able to authenticate and post tweets. It's 
just that I am not able to access this URL: 
'https://api.twitter.com/1.1/statuses/show/#tweet_id.json. On opening this URL 
in the browser, it is giving the above error. Can you clarify on this?

Original comment by ssr.digv...@gmail.com on 13 Jun 2013 at 8:03

GoogleCodeExporter commented 8 years ago
you can't visit most twitter api urls in a normal browser - your call won't 
have the signed oauth information.

you can construct  curl commands that add the header info with your signed keys 
and then it calls the url, but not with a normal browser.

twitter has a single-page web app that does the oauth stuff behind the scenes 
so you can test calls - that is on dev.twitter.com

Original comment by bear42 on 13 Jun 2013 at 11:11

GoogleCodeExporter commented 8 years ago
Can you please give some example for how can I do that? I am really trying to 
work this out but not getting anywhere.
One of the URL's : 
'https://api.twitter.com/1.1/statuses/show/340193666255692000.json'.

I have been able to retrieve this tweet before June 11 i.e the date twitter API 
officially shifter to v1.1.

Original comment by ssr.digv...@gmail.com on 14 Jun 2013 at 7:25

GoogleCodeExporter commented 8 years ago
any chance you can join the google group for python-twitter - others will be 
able to see our conversation and may have a better answer for you.

To make calls to the Twitter API now you have to include auth info - you get 
that by signing up to dev.twitter.com and adding an App at 
https://dev.twitter.com/apps

once you have an app defined (you don't need to have functional callback urls 
for command line clients) you can then get the 4 items for oauth keys.

twitter actually has a "make a sample call" helper button once you create an 
app. visit https://dev.twitter.com/docs/api/1.1/get/statuses/show/%3Aid and on 
the right hand side you will see a drop down to pick your registered app and a 
button to make the oauth call for the statuses/show

the page that it goes to allows you to fill in the different parts that make up 
a call and then to see what the header info would be *and* also a sample curl 
request.

Original comment by bear42 on 14 Jun 2013 at 8:07