xmlrpc with Basic Auth

2006-09-15 Thread Milos Prudek
I need to use XML-RPC call with Basic Authorization in HTTP headers. I found 
xmlrpclibBasicAuth.py, and it can be used as follows:

from xmlrpclibBasicAuth import Server
s=Server("http://www.example.com/rpc.php","user","pwd";)
print s.system.listMethods()

Is this possible in plain xmlrpclib, without xmlrpclibBasicAuth.py? 

I found the Transport class in xmlrpclib, and it has a method "get_host_info", 
which parses "user:pwd" out of "user:[EMAIL PROTECTED]". But when I tried to 
instantiate Server, it threw error "unsupported XML-RPC protocol". Here is a 
snippet:

from xmlrpclib import Server
s=Server("user:[EMAIL PROTECTED]://www.example.com/rpc.php")
...
File "/usr/local/lib/python2.3/xmlrpclib.py", line 1293, in __init__
raise IOError, "unsupported XML-RPC protocol"
IOError: unsupported XML-RPC protocol

I know that I am using it incorrectly. Does the basic authentication support 
in xmlrpclib mean something else than I take it for?

-- 
Milos Prudek
-- 
http://mail.python.org/mailman/listinfo/python-list


xmlrpc, extract data from http headers

2006-09-15 Thread Milos Prudek
I perform a XML-RPC call by calling xmlrpclibBasicAuth which in turn calls 
xmlrpclib. This call of course sends a HTTP request with correct HTTP 
headers. The response is correctly parsed by xmlrpclib, and I get my desired 
values. 

However, I also need to get the raw HTTP headers from the HTTP response. There 
is a cookie in the HTTP response and I need to read that cookie.

How could I do that?

-- 
Milos Prudek
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: xmlrpc, extract data from http headers

2006-09-16 Thread Milos Prudek

> Overload the _parse_response method of Transport in your
> BasicAuthTransport and extract headers from raw response. See the
> source of xmlrpclib.py in the standard library for details.

Thank you. 

I am a bit of a false beginner in Python. I have written only short scripts. I 
want to read "Dive into Python" to improve my knowledge. Your advice is 
perfect. It is my fault that I need a little more guidance.

I am not sure how the headers will be passed from Transport to the instance of 
ServerProxy. That is, if I change the _parse_response method, how do I 
retreive the headers using the ServerProxy command?


-- 
Milos Prudek
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: xmlrpc with Basic Auth

2006-09-16 Thread Milos Prudek
> i'm currently using xmlrpclib with basic auth and i use it like this:
> from xmlrpclib import Server
> s=Server("http://user:[EMAIL PROTECTED]/rpc.php")

Perfect! Thank you.


-- 
Milos Prudek
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: xmlrpc, extract data from http headers

2006-09-19 Thread Milos Prudek

> A better solution would be to extract cookies from headers in the
> request method and return them with response (see the code below). I

Full solution! Wow! Thank you very much. I certainly do not deserve such 
kindness. Thanks a lot Filip!

-- 
Milos Prudek
-- 
http://mail.python.org/mailman/listinfo/python-list


uninstall

2007-09-10 Thread Milos Prudek
I run "make install" of Python 2.4.4 and now I discovered that I do not like 
the default placement of my install. The Makefile does not support 
an "uninstall" option.

Is there a way to uninstall Python compiled from sources?

-- 
Milos Prudek
-- 
http://mail.python.org/mailman/listinfo/python-list


zlib

2007-09-10 Thread Milos Prudek
Although I have Python 2.5 with zlib in my Linux disto, I need to install my 
own Python (as most Zope developers do). Zope requires zlib. Python 2.4.4 
does not contain zlib. 

What is the correct procedure for installing zlib from source into Python?

-- 
Milos Prudek
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: uninstall

2007-09-10 Thread Milos Prudek
> If you're installing from sources "manually", you might want to
> consider checkinstall to give you the option of an uninstall for those
> software distributions which don't support "make uninstall":

I know about checkinstall and I often use it. If I remember correctly, Python 
failed to work with it. I admit I did not try to use checkinstall this time.

-- 
Milos Prudek
-- 
http://mail.python.org/mailman/listinfo/python-list


Why zlib not included in Python tarball?

2007-09-10 Thread Milos Prudek
 I need to install my own Python. I compiled Python 2.4.4 from sources. zlib 
did not compile - it's not in the lib-dynload directory.

I did not have this problem with any of my earlier Python compiles. I 
routinely compile Python from source.

What is the correct procedure for installing zlib from source into Python?

-- 
Milos Prudek
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: zlib

2007-09-11 Thread Milos Prudek
> > Although I have Python 2.5 with zlib in my Linux disto, I need to install
> > my own Python (as most Zope developers do).
>
> Why?

Because Zope often requires Python version slightly older than the most 
current one.

> So why does your own Python version have to be 2.4.4?

Because "Plone 3.0 requires Zope 2.10.4 and Python 2.4.4", as you can see on 
plone.org.


-- 
Milos Prudek
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why zlib not included in Python tarball?

2007-09-11 Thread Milos Prudek

> Depends on the operating system and the Python version. On Unix, you
> need to install zlib first; if you install a precompiled zlib package,
> make sure you install the header files as well.

You were right. Thank you. 



-- 
Milos Prudek
-- 
http://mail.python.org/mailman/listinfo/python-list


readline support on openSuSE

2007-10-17 Thread Milos Prudek
This question concerns compilation of Python from sources. Specifically Python 
2.3.6.

On Kubuntu 7.04, ./configure outputs these lines about readline:
checking for rl_pre_input_hook in -lreadline... yes
checking for rl_completion_matches in -lreadline... yes

On openSuSE 10.3, ./configure outputs these lines about readline:
checking for rl_pre_input_hook in -lreadline... no
checking for rl_completion_matches in -lreadline... no

And, of course, line editing in Python shell is possible on Kubuntu and 
impossible on openSuSE.

I do have libreadline5 and readline-devel RPM installed on openSuSE. What else 
might I need to have readline support?

-- 
Milos Prudek
-- 
http://mail.python.org/mailman/listinfo/python-list


module import problem

2008-05-24 Thread Milos Prudek
I have a Kubuntu upgrade script that fails to run:

File "/tmp/kde-root//DistUpgradeFetcherCore.py", 
line 34, in 
import GnuPGInterface
ImportError
No module named GnuPGInterface

I got a folder /usr/share/python-support/python-gnupginterface with 
a "GnuPGInterface.py" but no __init__.py.

In python command line, print sys.path shows that /usr/share/python-support/ 
is not among python paths.

If I cd into /usr/share/python-support/python-gnupginterface and launch Python 
I can "import GnuPGInterface". But when I run DistUpgradeFetcherCore.py in 
that folder it always fails with No module named GnuPGInterface.

 I do not know much about setting python path. 

-- 
Milos Prudek
--
http://mail.python.org/mailman/listinfo/python-list


Re: module import problem

2008-05-25 Thread Milos Prudek

> Reinstall the package "python-gnupginterface" with "sudo aptitude reinstall

Your advice helped! Upgrade is running now. Thanks!

-- 
Milos Prudek
--
http://mail.python.org/mailman/listinfo/python-list