[Zope] URL Substitution.
Art Hampton
arth@pacsg.css.mot.com
Fri, 11 Feb 2000 09:04:14 -0600
Argh, sorry I didn't see your posting sooner. I asked this question a
few weeks back, and someone was nice enough to point me to this:
http://www.zope.org/Members/lstaffor/ZClientMethod
But your version looks like it would be more adaptable for my needs
anyway, as one of the things I need it to do is go through a proxy
server.
"Alexandre A. Rodioukov" wrote:
>
> Ok, I'm posting followup to my one posting :) What I did, I finally
> decided to write external method. Here follows the code:
>
> [ http_fetch.py ]
> def fetch_file(uri):
> from httplib import HTTP
> from urlparse import urlparse
>
> parsed_uri=urlparse(uri)
>
> h = HTTP(parsed_uri[1])
> h.putrequest('GET', parsed_uri[2])
> h.putheader('Accept', 'text/html')
> h.putheader('Accept', 'text/plain')
> h.endheaders()
> errcode, errmsg, headers = h.getreply()
> if errcode == 200:
> f = h.getfile()
> return f.read()