Hello zope users, Can anybody explain how I can call Python Script on comp B Zope from Python Script on comp A Zope? Thanks in advance -- Best regards, alienoid mailto:alienoid@is.lg.ua
Could you do this by using httplib and urllib in an external script: Given that script name is "Script" and Comp B's name is CompB.com: import httplib, urllib def callRemoteScript() : scriptname = "/Script" conn = httplib.HTTPConnection('CompB.com') conn.request("GET", filename) response = conn.getresponse() data = response.read() conn.close() This is untested, but it should work with minor tweaks. Kevin -----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of alienoid Sent: Wednesday, August 28, 2002 1:25 PM To: zope@zope.org Subject: [Zope] calling PythonScript on another machine Hello zope users, Can anybody explain how I can call Python Script on comp B Zope from Python Script on comp A Zope? Thanks in advance -- Best regards, alienoid mailto:alienoid@is.lg.ua _______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Could you do this by using httplib and urllib in an external script:
...or use xmlrpc, heres how to call a Python Script named "search_xml" on "zopezen.org"... from xmlrpclib import Server srv = Server('http://www.zopezen.org/') results = srv.search_xml('Zope') results['results'][0] -- Andy McKay Agmweb Consulting http://www.agmweb.ca
On Wed, Aug 28, 2002 at 02:59:28PM -0400, Kevin Carlson wrote:
Could you do this by using httplib and urllib in an external script:
I do pretty much the same thing to slurp some content from another web app. server (which shall remain nameless) into Zope. Here's the relevant bit (tested and working as an external method): def pagesuck(site="http://www.foo.com", page="path/to/object"): remote = httplib.HTTP(site) remote.putrequest('GET', page) remote.putheader('Accept', 'text/html') remote.putheader('Accept', 'text/plain') remote.endheaders() errcode, errmsg, headers = remote.getreply() if errcode != 200: return "Could not open the page. Error %d: %s" % (errcode, errmsg) f = remote.getfile() data = f.read() f.close() -- Paul Winkler "Welcome to Muppet Labs, where the future is made - today!"
participants (4)
-
alienoid -
Andy McKay -
Kevin Carlson -
Paul Winkler