Hi Jeff,
The following will let you test it.
import suds
l_wsdl = 'http://webservices.daehosting.com/services/isbnservice.wso?WSDL'
l_client = suds.client.Client(l_wsdl, gzip = False)
l_result = l_client.service.IsValidISBN10('0123456789')
print l_result
# default behaviour is gzip = True as below
l_client2 = suds.client.Client(l_wsdl, gzip = True)
l_result = l_client2.service.IsValidISBN10('0123456789')
print l_result
Anyhow, I think that the changes can be implemented also for Transport.open,
so that if you have to download large WSDL files, the download will also
happen compressed (if supported by the server)
I even think that the compression request and processing could be part of
the Transport class, to let people implement transport with libraries that
may not have native gzip support.
Since I have some free time in the next minutes, I will possibly add a new
patch to the ticket, so you may decide which one you like more
Best regards
Daniel
On Wed, May 5, 2010 at 20:52, Jeff Ortel <jortel(a)redhat.com> wrote:
Hey Daniel,
Thanks for the great suggestion, patch and for creating a ticket for this.
I'll review for inclusion in 0.4. Can you recommend a public test
site/service for this?
Regards,
Jeff
On 04/29/2010 07:53 AM, Daniel Rodriguez wrote:
> Hello,
>
> I have added ticket 311 requesting this enhancement with attached
> patches for transport/http.py and transport/options.py
>
> Requesting compression can be turned off and on with the "gzip" option
> (a bool)
>
> The gzip decompression code works always. The reasoning behind this is:
>
> * Some network providers may compress the data in HTTP responses in
> order to decrease network traffic, expecting all clients to be
> ready to decompress data
>
> Best regards
>
> Daniel
>
> On Sat, Apr 3, 2010 at 21:07, Daniel Rodriguez <danjrod(a)gmail.com
> <mailto:danjrod@gmail.com>> wrote:
>
> A "break" at the end of the "if" statement will not hurt and
avoid
> checking unnecessary headers.
>
> Best regards
>
>
> On Sat, Apr 3, 2010 at 02:14, Daniel Rodriguez <danjrod(a)gmail.com
> <mailto:danjrod@gmail.com>> wrote:
>
> Hi Jeff et al,
>
> If I am not wrong (I may have missed a configuration option),
> suds is not using or requesting gzip compression.
>
> I have added a few lines and tested at least requesting and
> accepting gzip compression. My changes have been trivial and
> this could be possibly added as an option to suds.
>
> The changes I have made (against 3.9):
>
> _File_: suds/transport/http.py:
> _
> _
> _Extra imports_:
>
> import gzip
> import StringIO
>
> _Class_: HttpTransport
> _Method_: send
>
> _Added:_
>
> After:
>
> * headers = request.headers
>
> added the following line
>
> * headers.update([('Accept-Encoding', 'gzip')])
>
> _Changed:_
>
> * result = Reply(200, fp.headers.dict, fp.read())
>
> to
>
> * replydata = fp.read()
> * for header in fp.headers.dict.keys():
> * if header.lower() == 'content-encoding' and
> fp.headers.dict[header] == 'gzip':
> * replydatacompressedstream =
> StringIO.StringIO(replydata)
> * gzipper =
> gzip.GzipFile(fileobj=replydatacompressedstream)
> * replydata = gzipper.read()
> * result = Reply(200, fp.headers.dict, replydata)
>
> Best regards
>
> Daniel
>
>
>
>
>
> _______________________________________________
> suds mailing list
> suds(a)lists.fedoraproject.org
>
https://admin.fedoraproject.org/mailman/listinfo/suds
>