[Zope] Using urllib2 to access Zope URLs

Dieter Maurer dieter@handshake.de
Tue, 27 May 2003 22:54:40 +0200


Damon Butler wrote at 2003-5-27 15:15 -0500:
 > ...
 > Here's a sample command line and the resultant Traceback from an attempt
 > to upload a small text file:
 > 
 > ====================
 > % python Client.py -u me:mypasswd http://localhost:8080/manage_addFile
 > id=smallTextFile.txt file:file=/home/damon/tmp/smallTextFile.txt
 > 
 > Traceback (most recent call last):
 >   File "./Client.py", line 563, in ?
 >     main()
 >   File "./Client.py", line 556, in main
 >     headers, body = apply(f,(),kw)
 >   File "./Client.py", line 109, in __call__
 >     if hasattr(v,'read'): return self._mp_call(kw)
 >   File "./Client.py", line 231, in _mp_call
 >     self.handleError('', ec, em, headers, response)
 >   File "./Client.py", line 170, in handleError
 >     raise t, RemoteException(t,v,f,l,self.url,query,ec,em,response)
 > bci.ServerError: 302 (File: Unknown Line: Unknown)
 > 302 Moved Temporarily for http://localhost:8080/manage_addFile
 > ====================
 > 
 > Any idea what's happening?

You could ignore this "error".

The HTTP spec says, that response codes 2xx are good and response
codes 3xx mean, the request is not complete.
Apparently, "Client" interprets the HTTP spec very tightly.
Any response code other than 2xx results in an exception.

For most automisation tasks, response code 302 can be treated
as "ok", however.



....  hangs for large files ....

I analysed such a problem recently. It turned out that
the script did not hang but that the transfer took very
long. In my case, the transfer of a 60 MB file took 11 minutes (locally
on one host). During this time, the IOWait of the
processor was between 50 and 90 %.
I was really astonished about this low bandwidth.
I do not know what subcomponent was responsible but I am
sure it was not ZPublisher.Client (it just builds a huge string
and transfers it via the socket in a single "send"; this is very
memory intensive but should not cause high IOWait over minutes
(reading the file took 20 s)).


Dieter