I'm sorry for being in late, anyway this is how i got it working (you
should add @expose('json') to manage_permission_only on a default tg2
quickstart root.py):# -*- coding: UTF-8 -*- from restful_lib import Connection base_url="http://localhost:8080" import urllib import httplib2 http = httplib2.Http() url = base_url + '/login_handler' body = {'login': 'manager', 'password':'managepass'} headers = {'Content-type': 'application/x-www-form-urlencoded'} response, content = http.request(url, 'POST', headers=headers, body=urllib.urlencode(body)) if response.has_key('set-cookie'): headers = {'Cookie': response['set-cookie'], 'Accept':'text/json'} url = base_url + 'manage_permission_only' conn = Connection(base_url) ret = conn.request_get('/manage_permission_only', args={'tg_format':'json'}, headers=headers) print ret['body'].encode('utf-8') else: print "Can not login" 2009/9/7 Jamie Bullock <[email protected]>: > > > I found the answer in this thread: > http://www.nabble.com/urllib2-access-to-a-tg2-app-(with-repoze.what-auth)-td23201514.html > > Once you have authenticated, python-rest-client can access restricted > resources transparently. > > Jamie > > > On Jul 17, 9:36 am, Daniele Favara <[email protected]> wrote: >> Hi all, >> >> i'm playing with the libs from the following project: >> >> http://code.google.com/p/python-rest-client >> >> How can i login to tg2 app using python-rest-client Connection ? >> >> Any idea ? >> >> -- >> Daniele Favara > > > -- Daniele Favara --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/turbogears?hl=en -~----------~----~----~----~------~----~------~--~---

