Created
March 10, 2009 19:21
-
-
Save taboularasa/77079 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SendTweet(webapp.RequestHandler): | |
def post(self): | |
self.response.headers['Content-Type'] = 'text/plain' | |
tweet = cgi.escape(self.request.get('content')) + "duhhh" | |
username = "username" | |
login = username | |
password = "password" | |
payload= {'status' : tweet, 'source' : "GAE script"} | |
payload= urllib.urlencode(payload) | |
base64string = base64.encodestring('%s:%s' % (login, password))[:-1] | |
headers = {'Authorization': "Basic %s" % base64string} | |
url = "http://twitter.com/statuses/update.xml" | |
result = urlfetch.fetch(url, payload=payload, method=urlfetch.POST, headers=headers) | |
self.response.out.write(result.content) | |
def get_tweet(self): | |
tweet = "this is a tweet" | |
return tweet |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment