Re: python-soappy
tooper a écrit : > On the client side : > from SOAPpy import SOAPProxy > server= SOAPProxy("http://foo.bar.org:8090";) > print server.Hello("world") > > On the server side : > from SOAPpy import SOAPServer > > def Hello(name): > return "Hello "+name+" !" > > server= SOAPServer(("localhost",8080)) > server.registerFunction(Hello) > server.serve_forever() > look at http://diveintopython.org/, Mark Pilgrim there is a Python book including interesting chapter about SOAP. While talking about SOAPpy module, I'm facing an authentication problem with it: I'm consuming a WebServices server requiring authentication, and I did not found yet how to give authentication code (username:password) while calling any mehode of the webservice. I did a temp trick around while waiting the *right* solution... When authentication is not required , it works very well, and the automatic introspection is transparently handled by simple or imbriqued python types (sequences, etc. ...) -- http://mail.python.org/mailman/listinfo/python-list
Re: python-soappy
Mikalai a écrit : >> While talking about SOAPpy module, I'm facing an authentication problem >> with it: >> >> I'm consuming a WebServices server requiring authentication, and I did >> not found yet how to give authentication code (username:password) while >> calling any mehode of the webservice. >> > > In Apache+mod_python I use apaches authentication and ssl. Simply works > here is my code sample: wsdlFile = 'http://MYuser:[EMAIL PROTECTED]:8080/MYservices/MYservice?wsdl' MYservice = WSDL.Proxy(wsdlFile) print server.methods.keys() # there is a method named searchAnything resultat = MYservice.searchAnything(param_1, etc. ..., param_n) while executing this call, SOAPpy does not send http authorization header line: ... Authorization: Basic ... and the call fails, with error code: java.util.MissingResourceException: Can't find resource for bundle org.apache.axis.i18n.ProjectResourceBundle, key cantAuthorize So there is 2 phases: 1/Service acquisition 2/Methode call and between them, user:pass is lost somewhere ... thanks for any help -- http://mail.python.org/mailman/listinfo/python-list
question about SOAPpy
Hello Pythoneers: I would like to ask you a simple question: Are you satisfied by SOAPpy module? Actually, I use this module since a year and i immediately found it very well-implemented, corresponding to dynamic "meta-data" discovering nature of SOAP/WSDL. BUT i read sometimes threads saying that SOAPpy is "dead" and we should all migrationg to Zolera SOAP Infrastructure (ZSI) module. Can you tell me what do you think about it ? thanks. -- http://mail.python.org/mailman/listinfo/python-list
apache & mod_python
Hi, bonjour, witch versions are suitable to use for apache & mod_python ? Can i install and use "Apache 2.2.3" & "mod_python 3.2.10" (most recent versions) without facing any known major issue ? thanks for any help. -- http://mail.python.org/mailman/listinfo/python-list
Apache 2.2.3 and mod_python 3.2.10
I installed Apache 2.2.3 and mod_python 3.2.10 on WinXP plateform I configured mod_python via httpd.conf: LoadModule python_module modules/mod_python.so but my script folder configuration doesn't work correctely: Alias /myfolder D:/myfolder Order allow,deny Allow from all AddHandler mod_python .py PythonHandler mod_python.publisher PythonDebug On for test, this is a sample script d:\myfolder\test.py # test.py # from mod_python import apache # def hello(name=None): if name: return 'Hello, %s!' % name.capitalize() else: return 'Hello there!' # def handler(req): req.content_type = 'text/plain' req.write("from handler test, Hello World!") return apache.OK when I access to the url http://localhost/monrep/test.py, I obtain source test.py listing but not the rendering of handler or hello method. with url http://localhost/theriaque/test.py/hello, I obtain : =>The requested URL /theriaque/test.py/hello was not found on this server. It seems like something is missing ... but what ? thanks for any help -- http://mail.python.org/mailman/listinfo/python-list
Re: Apache 2.2.3 and mod_python 3.2.10
sorry, I give here the right paths: I installed Apache 2.2.3 and mod_python 3.2.10 on WinXP plateform I configured mod_python via httpd.conf: LoadModule python_module modules/mod_python.so but my script folder configuration doesn't work correctely: Alias /myfolder D:/myfolder Order allow,deny Allow from all AddHandler mod_python .py PythonHandler mod_python.publisher PythonDebug On for test, this is a sample script d:\myfolder\test.py # test.py # from mod_python import apache # def hello(name=None): if name: return 'Hello, %s!' % name.capitalize() else: return 'Hello there!' # def handler(req): req.content_type = 'text/plain' req.write("from handler test, Hello World!") return apache.OK when I access to the url http://localhost/myfolder/test.py, I obtain source test.py listing but not the rendering of handler or hello method. with url http://localhost/myfolder/test.py/hello, I obtain : =>The requested URL /myfolder/test.py/hello was not found on this server. It seems like something is missing ... but what ? thanks for any help -- http://mail.python.org/mailman/listinfo/python-list
windows cetificates
hi, is there any way to decrypt an email (already read with poplib, so available on client side) with python using a window certificate (those we can see on ie/internet options/content/certificates) ? the purpose is to decrypt an email sent and crypted by the sender with both his own certificate and the recipient one. thanks for any help. -- http://mail.python.org/mailman/listinfo/python-list
Re: windows cetificates
thank you I will take a look on capicom ... Roger Upole a écrit : > m.banaouas wrote: >> hi, >> >> is there any way to decrypt an email (already read with poplib, so available >> on client side) with python using a window >> certificate (those we can see on ie/internet options/content/certificates) ? >> >> the purpose is to decrypt an email sent and crypted by the sender with both >> his own certificate and the recipient one. >> >> thanks for any help. > > If the messages use standard encoding, you should be able to use CAPICOM. > The interfaces are fairly simple to use through win32com.client. > The 'capicom.envelopeddata' object encrypts and decrypts using certificate > keys. > > Roger > > > > > == Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet > News== > http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 > Newsgroups > ---= East/West-Coast Server Farms - Total Privacy via Encryption =--- -- http://mail.python.org/mailman/listinfo/python-list
urllib2 and HTTPBasicAuthHandler
Hi all, I started to use urllib2 library and HTTPBasicAuthHandler class in order to authenticate with a http server (Zope in this case). I don't know why but it doesn't work, while authenticating with direct headers manipulation works fine! WinXP Sp2 Python 2.4.4 Thanks in advance for your help/comments # TestAuthHandler.py import base64, httplib, urllib2 httplib.HTTPConnection.debuglevel = 1 # def TestAuth(method): data = {'prot':'http','user':'admin','pass':'xx','host':'localhost','port':'8080','path':'manage','realm':'Zope'} url = '%(prot)s://%(host)s:%(port)s/%(path)s' % data req = urllib2.Request(url) # if (method == 'headers'): base64string = base64.encodestring('%s:%s' % (data['user'], data['pass']))[:-1] req.add_header("Authorization", "Basic %s" % base64string) elif (method == 'handler'): auth_url = '%(host)s:%(port)s/%(path)s' % data auth_handler = urllib2.HTTPBasicAuthHandler() auth_handler.add_password(data['realm'], auth_url, data['user'], data['pass']) opener = urllib2.build_opener(auth_handler) urllib2.install_opener(opener) # f = urllib2.urlopen(req) data = f.read() print data # TestAuth('headers') TestAuth('handler') - output: - http://www.w3.org/TR/REC-html40/loose.dtd";> Zope on http://localhost:8080 ... all right page ... Traceback (most recent call last): File "C:\Test\TestAuthHandler.py", line 25, in ? TestAuth('handler') File "C:\Test\TestAuthHandler.py", line 20, in TestAuth f = urllib2.urlopen(req) File "C:\Python\Lib\urllib2.py", line 130, in urlopen return _opener.open(url, data) File "C:\Python\Lib\urllib2.py", line 364, in open response = meth(req, response) File "C:\Python\Lib\urllib2.py", line 471, in http_response response = self.parent.error( File "C:\Python\Lib\urllib2.py", line 402, in error return self._call_chain(*args) File "C:\Python\Lib\urllib2.py", line 337, in _call_chain result = func(*args) File "C:\Python\Lib\urllib2.py", line 480, in http_error_default raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) urllib2.HTTPError: HTTP Error 401: Unauthorized Process "Python" completed with Exit Code 1, at 16/01/2007 16:51:18. -- http://mail.python.org/mailman/listinfo/python-list
Re: urllib2 and HTTPBasicAuthHandler
Max, I verified and determined that Zope realm is "Zope", by tcp spy tool witch shows me the server headers. Actually, I tried differents ways without success. It seems like it's not so easy to negociate a basic authentication process with urllib2, while it's based on very simple specifications, however urllib2 is considered as one of the most powerfull library in its category. You suggest to use default realm: # this creates a password manager passman = urllib2.HTTPPasswordMgrWithDefaultRealm() # because we have put None at the start it will always use this username/password combination passman.add_password(None, auth_url, data['user'] , data['pass']) # create the AuthHandler auth_handler = urllib2.HTTPBasicAuthHandler(passman) # build an 'opener' using the handler we've created opener = urllib2.build_opener(auth_handler) urllib2.install_opener(opener) req = urllib2.Request(url) f = urllib2.urlopen(req) data = f.read() print data but it doesn't work: urllib2.HTTPError: HTTP Error 401: Unauthorized Max Erickson a écrit : > "m.banaouas" <[EMAIL PROTECTED]> wrote: > >> Hi all, >> I started to use urllib2 library and HTTPBasicAuthHandler class >> in order to authenticate with a http server (Zope in this case). >> I don't know why but it doesn't work, while authenticating with >> direct headers manipulation works fine! >> > ... >> port':'8080','path':'manage','realm':'Zope'} >>url = '%(prot)s://%(host)s:%(port)s/%(path)s' % data > ... > > Are you certain that the realm on the server matches 'Zope'? > > HTTPBasicAuthHandler uses the realm to look for the password, if the > realm the server provides is different, urllib2 will respond as if it > does not have a user/password. > > If you are only doing one request, it isn't that big a deal; if you > are doing many requests or want urllib2 to handle the response for > other reseans, you can use a default realm, see the bottom of this > example: > > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/305288 > > (The advantage of using a default rather than making sure the realm is > correct is that it can change and you won't have to do anything) > > > > max > -- http://mail.python.org/mailman/listinfo/python-list
Re: OpenOffice 2.0 UNO update Links; need help
Sells, Fred a écrit : > I've got a ~100 page document I assemble from ~30 OOo .odt files with some > search and replace functions. I then produce a PDF. So far so good. > > Now I need to get a barcode from our internal website and insert that. The > barcode will vary based on some parameters. Our internal site provides a > .jpg image (or .gif) based on those parameters. > > Can anyone provide a snippet or some pointers on how to do this. I've > googled it to death and checked the OOo DevGuide to no avail. > > Either python or java solution is acceptable. > > you can use urllib2 python module: # TestGoogle.py # import urllib2 # f = urllib2.urlopen('http://www.google.fr/images/nav_logo.png') data = f.read() f = file('nav_logo.png', 'w') f.write(data) f.close() in your case, may be parameters are passed thru url to get a particular barcode image (http://myserver/myapplication/barcode?format=xxx&id=yyy etc. ...). for authentication, if any, it needs a little more sophisticated coding. -- http://mail.python.org/mailman/listinfo/python-list
file date/time on windows
hi, I noticed recently that the value of file date/time I get with python: time.strftime('%Y-%m-%d %H:%M', time.gmtime(os.stat(fullname).st_mtime)) is forwarding by one hour the real file date/time. Example: file A.txt: 2009-01-18 16:13 returned valeur: 2009-01-28 15:13 Is there a simple way to get it work correctely (other than adding always 1 hour ...) ? thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: file date/time on windows
thanks, someone gave me the solution: simply call time.localtime(...) instead of time.gmtime(...) The explorer file time is what I need because it's the only file date visible for most of users. So localtime is perfect for me. We are talking about the same file stored in a shared lan-computer-folder. I gess that if computers of those users are in different timezones, they could see different file date ? MRAB a écrit : > m.banaouas wrote: >> hi, >> >> I noticed recently that the value of file date/time I get with python: >> time.strftime('%Y-%m-%d %H:%M', time.gmtime(os.stat(fullname).st_mtime)) >> is forwarding by one hour the real file date/time. >> >> Example: >> file A.txt: 2009-01-18 16:13 >> returned valeur: 2009-01-28 15:13 >> >> Is there a simple way to get it work correctely (other than adding >> always 1 >> hour ...) ? >> > time.gmtime(), as the name suggests, returns GMT (UTC). > > From your email address I presume you're in France, which is GMT+1. > > Windows Explorer shows the file time in local time, which for you is > currently GMT+1, but when the clocks go forward (DST) it'll be GMT+2. -- http://mail.python.org/mailman/listinfo/python-list
ElementTree and clone element toot
Hi all, Working with the ElementTree module, I looked for clone element function but not found such tool: def CloneElment(fromElem, destRoot = None) fromElem is the element to clone destRoot is the parent element of the new element ; if None so the new element will be child of fromElem parent. The clone operation is recursive to make it process all subtree of the element to clone. here is my first implementation: def CloneElement(fromElem, destRoot = None): if destRoot == None: fromRoot = ET.ElementTree(fromElem).getroot() destRoot = fromRoot destElem = destRoot.makeelement(fromElem.tag, fromElem.attrib) destRoot.append(destElem) destElem.text = fromElem.text for e in fromElem.findall('*'): CloneElement(e, destElem) # this function works fine only if destRoot parameter is defined by the caller context. The problem is about retreiving parent element: I didn't found any way to determine the parent element of an element "elem" by asking elem itself! and ET.ElementTree(fromElem).getroot() is wrong because it returns fromElem itself, not its parent. Thanks for any help. -- http://mail.python.org/mailman/listinfo/python-list
Re: ElementTree and clone element toot
My python version is 2.4.4 def SubElement(parent, tag, attrib={}, **extra): Can you tell me how does "parent" issue could be solved by SubElement ? I'm looking for how to determine element parent just by asking element it self. It seems like element doesn't know witch is its parent, while any parent knows well witch are its childs. My goal is to clone an element and attach it to a specified parent or to parant of original element to clone. may be better implementation of CloneElement is to let the caller context make the attachement between the clone and its parent. Gabriel Genellina a écrit : > En Mon, 02 Feb 2009 12:37:36 -0200, Gerard Flanagan > escribió: > >> e = ET.fromstring(s) >> >> def clone(elem): >> ret = elem.makeelement(elem.tag, elem.attrib) >> ret.text = elem.text >> for child in elem: >> ret.append(clone(child)) >> return ret >> >> f = clone(e) > > You forget the tail attribute, and you also should use the SubElement > factory instead of makeelement as documented; doing that fixes the > "parent" issue too. > -- http://mail.python.org/mailman/listinfo/python-list
Re: Calling Web Services from Python
Can you tell us more about SOAPpy bug ? Is it about authentication ? Ivan Zuzak a écrit : >... > I need a package/tool that generates web service proxies that will do > all the low-level HTTP work. (Someting like the WSDL.EXE tool in .NET > Framework) The ZSI and SOAPy packages [1] that i found (should) have > those functionalities but either have a bug (SOAPy) or either do not > work for arbitrary web services (ZSI). > ... -- http://mail.python.org/mailman/listinfo/python-list