ElementTree.write() to an URL is using PUT, not POST

Bug #1857822 reported by MestreLion
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxml
Confirmed
Low
Unassigned

Bug Description

Python : sys.version_info(major=3, minor=6, micro=9, releaselevel='final', serial=0)
lxml.etree : (4, 2, 1, 0)
libxml used : (2, 9, 4)
libxml compiled : (2, 9, 4)
libxslt used : (1, 1, 29)
libxslt compiled : (1, 1, 29)

When writing a XML to an URL, lxml ends up using HTTP PUT method instead of POST. Documentation at https://lxml.de/tutorial.html says:

> ... or the ElementTree.write() method that writes to a file, a file-like object, or a URL (via FTP PUT or HTTP POST).

Either docs or code should be fixed to match each other. If possible, the HTTP method should be an argument to ElementTree.write().

I've looked at both lxml and libxml2 source codes, all it takes for lxml to use POST is a call to libxml2's `xmlRegisterHTTPPostCallbacks()`

Revision history for this message
scoder (scoder) wrote :

PUT seems right. Could you provide a PR to fix the docs?

Enabling POST requests then is a new feature. Feel free to work on that, too, if you want.

Changed in lxml:
importance: Undecided → Low
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.