Skip to content

Instantly share code, notes, and snippets.

@taboularasa
Created March 10, 2009 19:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taboularasa/77079 to your computer and use it in GitHub Desktop.
Save taboularasa/77079 to your computer and use it in GitHub Desktop.
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