I am using this function and it works great, now I want to use values from a form (textarea)for the username and password, this does not work and twitter returns a html 401 so I guess the values are not in correct format but I thought they would just be strings??? any help appreciated chrism
On Nov 29, 10:57 am, murray3 <ch...@murraypost.net> wrote: > see ammendments and it worked thanks > urllib2 and request > > On Nov 28, 10:47 pm, murray3 <ch...@murraypost.net> wrote: > > > def twitter_post(username,password,message): > > import urllib, urllib2, base64, gluon.contrib.simplejson > > args= urllib.urlencode([('status',message)]) > > headers={} > > headers['Authorization'] = 'Basic '+base64.b64encode(username > > +':'+password) > > request = urllib2.Request('http://twitter.com/statuses/ > > update.json', args, headers) > > return gluon.contrib.simplejson.loads(urllib2.urlopen(request).read > > ()) > > > Massimo could you offer some example view code to use this function, > > regards > > chrism -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.