0
使用Django和requests,我想调用由Geoserver配置的其余服务器。在Geoserver docs中,有一些cURL可用于与服务器进行通信。 例如,这个卷曲:将geoserver cURL转换为python请求
curl -v -u admin:geoserver -XPOST -H "Content-type: text/xml"
-d "<workspace><name>acme</name></workspace>"
http://localhost:8080/geoserver/rest/workspaces
创建一个新的工作区。 如何将此cURL转换为python请求?此外,我使用下面的代码,但它不成功。
payload = {'-d':'<workspace><name>acme</name></workspace>'}
headers = {'content-type': 'text/xml'}
r = requests.post("http://localhost:8080/geoserver/rest/workspaces", auth=('admin', 'geoserver'),
data=payload,headers=headers)