[Zope-CMF] wget equivalent

Carl Rendell cer@sol43.com
Wed, 20 Mar 2002 11:42:54 -0800


Thanks for everyone who responded so quickly. Frankly I was 
surprised by the response!

All of the methods were of use, but what I wanted was accomplished 
from the pointer Joseph pointed me toward:

http://www.zope.org/Members/lstaffor/ZClientMethod

Straight forward actually. For the benefit of others -

External method webClient -

from ZPublisher import Client

def web_client(url = 'http://www.yahoo.com/', urlParam=None, 
username = None, password = None, **kw):
      '''access http servers'''
      if kw:
          return Client.call(url,username,password,kw)[1]
      else:
          return Client.call(url,username,password)[1]

External method webQuote

from Products.PythonScripts.standard import url_quote

def web_quote(param = 'http://www.yahoo.com/'):
      '''url encode a string'''
      return url_quote(param)

Created a dtml method to process the results

<dtml-let exURL="('http://'+xhost)"
                  c="webQuote(c)"
                  o="webQuote(o)"
                  exURL="(exURL+'?c='+c+'&o='+o)">
<dtml-var "webClient(exURL)">
</dtml-let>


All of the above works like a charm. Thanks again for all who responded.

~C


Carl E. Rendell
Solution43
Information Distribution Consulting        |   "Ahhhh the power of
cer@sol43.com                              |    acquisition"  - Chef Z