This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author henrik242
Recipients apetresc, henrik242
Date 2020-03-09.06:58:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1583737097.86.0.991400971639.issue39875@roundup.psfhosted.org>
In-reply-to
Content
Solved! 

The problem was Solr which it has special handling of POSTed data with the User-Agent starts with 'curl/': https://github.com/apache/lucene-solr/blob/40661489cd590947f513e553a20707d0c82b82e5/solr/core/src/java/org/apache/solr/servlet/SolrRequestParsers.java#L782

In all other cases Solr expects the Content-Type to be text/xml.  Setting that with urrlib.request makes the request work fine:

>>> req = urllib.request.Request(url, data.encode('utf-8'), headers={'Content-Type': 'text/xml'})
>>> res = urllib.request.urlopen(req)

A big thanks to https://stackoverflow.com/a/60586102/13365 for figuring this out
History
Date User Action Args
2020-03-09 06:58:17henrik242setrecipients: + henrik242, apetresc
2020-03-09 06:58:17henrik242setmessageid: <1583737097.86.0.991400971639.issue39875@roundup.psfhosted.org>
2020-03-09 06:58:17henrik242linkissue39875 messages
2020-03-09 06:58:17henrik242create