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

David Bear David.Bear at asu.edu
Mon Nov 15 10:48:01 EST 2010


urlopen is restricted python. You will need to create file system script (a
product) (or external script) in order to use it.

On Mon, Nov 15, 2010 at 8:43 AM, <stephan0h at gmx.net> wrote:

> 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
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> https://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  https://mail.zope.org/mailman/listinfo/zope-announce
>  https://mail.zope.org/mailman/listinfo/zope-dev )
>



-- 
David Bear
College of Public Programs at ASU
602-494-0424
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20101115/6f647663/attachment.html 


More information about the Zope mailing list