以下のcurlコマンドに相当するPythonを探しています。
curl http://localhost/x/y/update -H 'Content-type: text/xml; charset=utf-8' --data-binary @filename.xml
ちなみに、私は通常、以下のコードを使用してデータを文字列として投稿します。
curl http://localhost/x/y/update --data '<data>the data is here</data>' -H 'Content-type:text/xml; charset=utf-8'
baseurl = http://localhost/x/y
thedata = '<data>the data is here</data>'
headers = {"Content-type": "text/xml", "charset": "utf-8"}
thequery = urlparse.urljoin(baseurl, thedata, querycontext)
therequest = urllib2.Request(thequery, headers)
theresponse = urllib2.urlopen(therequest)