Some of the information here may be outdated, please check the book instead

post a twit

def post_twit(username,password,message):
  import urllib, urlib2, base64
  import gluon.contrib.simplejson as sj
  args= urllib.urlencode([('status',message)])
  headers['Authorization'] = 'Basic '+base64.b64encode(username+':'+password)
  request = urllib2.Request('', args, headers)
  return  sj.loads(urllib2.urlopen(req).read())

get twits

def get_twits():
  import gluon.contrib.simplejson as sj
  page ='' % user)
  return dict(tweets=tweets)

No third party libraries required. Just old plain web2py.

© 2008-2010 by Massimo Di Pierro - All rights reserved - Powered by web2py - design derived from a theme by the earlybird
The content of this book is released under the Artistic License 2.0 - Modified content cannot be reproduced.