I'm trying to use twitter-python to connect to twitter's API, and I keep getting this pesky 404 error!
Code is below:
import sys
import twitter
def main():
api = twitter.Api()
statuses = api.GetPublicTimeline()
print [s.user.name for s in statuses]
It should come back with the names of people who've posted status updates on the public timeline, but I get this traceback instead.
Traceback (most recent call last):
File "new.py", line 14, in <module>
main()
File "new.py", line 10, in main
statuses = api.GetPublicTimeline()
File "/usr/lib/pymodules/python2.7/twitter.py", line 1319, in GetPublicTimeline
json = self._FetchUrl(url, parameters=parameters)
File "/usr/lib/pymodules/python2.7/twitter.py", line 2030, in _FetchUrl
url_data = opener.open(url, encoded_post_data).read()
File "/usr/lib/python2.7/urllib2.py", line 400, in open
response = meth(req, response)
File "/usr/lib/python2.7/urllib2.py", line 513, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.7/urllib2.py", line 438, in error
return self._call_chain(*args)
File "/usr/lib/python2.7/urllib2.py", line 372, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 521, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 404: Not Found
If I try to authenticate, all of my requests come back as 401.
Thanks for your help!