Tweepy: TweepError: 'Bad Authentication Data' code 215


OAuth has cost me 10 wasted hours so far and continues to make my life an existential hell.

I am trying to use the Twitter API with Google App Engine. There seems to be precious little that will work on that particular platform because of Google’s aversion to third party libraries, or package dependencies, or what have you.

Tweepy is one I’ve been trying, but it doesn’t authenticate.

Here’s the “Inspect Network Request” data from my web console, FWIW:


POST http://localhost:9082/tweet [HTTP/1.1 500 Internal Server Error 1084ms]

Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:20.0) Gecko/20100101 Firefox/20.0
Accept-Encoding:gzip, deflate

Sent Cookie
csrftoken:[also redacted]

Expires:Fri, 01 Jan 1990 00:00:00 GMT
Date:Wed, 15 May 2013 09:28:47 GMT


The program throws a stack trace in the Google App Engine Launcher console and I get the message “TweepError: [{u’message’: u’Bad Authentication data’, u’code’: 215}]”

  1. Does anyone here successfully authenticate on App Engine with Python ? Do you use a Twitter API library, or do you roll your own methods?

  2. IDK, maybe I will need to use an OAuth library for App Engine that doesn’t integrate the Twitter API. Which I don’t know how to do. Wouldn’t that force me to tailor my own HTTP request headers and do tons of work?

Forgive me if these are stupid questions, please. I’m at my wit’s end.


I realized that the HTTP Header I included is probably not helpful because my program (via App Engine Launcher server on my localhost) is what sends the OAuth requests (using Tweepy), upon sending a POST request (the included header). But if there’s some more information I can send that will help, please do let me know and I’ll do my best.

Many thanks.


I use:
if os.environ.get(‘SERVER_SOFTWARE’, ‘’).startswith(‘Dev’):