mvantellingen / python-zeep

A Python SOAP client
http://docs.python-zeep.org
Other
1.87k stars 578 forks source link

Properly close 'file://' resources #1393

Open CharString opened 9 months ago

CharString commented 9 months ago

I bumped into this when opening several wsdl which in turn opened lots of xsd, with 'file://' scheme.

The issue was that the resp.raw.close nor resp.raw.release_conn set in the FileAdapter were ever called.

It's unclear to me whether this should be fixed in requests. It doesn't do that great a job at resource management for the naive user aka Human™. It makes sense to me that exhaustively reading Response.raw should close it unless the caller explicitly set stream on the request. Probably by using this closing pattern in the generator in Response.iter_content.

Workarounds without this fix: