[Zope] urllib.urlopen inside a python-script? alternatives?

stephan0h at gmx.net stephan0h at gmx.net
Mon Nov 15 10:43:09 EST 2010


Hello,

I'm trying to use facebook's single-sign-on mechanism with zope and 
querying account information for logged in facebook-users from within zope.

For this I need to send url-requests from my zope-server to the 
facebook-servers and read the response. I tried to test the concept with 
a python-script:

##############
import urllib

cookie= request["fbs_" + "<the application id>"]

args=dict(map(lambda x:x.split('='),cookie.split('&')))

url="https://graph.facebook.com/me?access_token="+args['access_token']

file = urllib.urlopen(url)
resp=file.read()
file.close()

return args,url,resp
##############

When running this an authentication-window pops up - and subsequently 
tells me:

-----------
Error Type: Unauthorized
Error Value: You are not allowed to access 'urlopen' in this context
-----------

So the problem is with opening the external-url I suppose ...

What's the Zope-way of doing this? - how can I tell it to get read 
information of another URL?

thanks,
stephan


More information about the Zope mailing list