curl -d @ ***转化为 requests语句是什么?
例如:
curl -v -u admin:geoserver -XPUT -H "Content-type: application/vnd.ogc.sld+xml" -d @roads.sld http://localhost:8080/geoserver/rest/styles/roads_style
这个语句转化为requests改怎么写?
curl -d @ ***转化为 requests语句是什么?
例如:
curl -v -u admin:geoserver -XPUT -H "Content-type: application/vnd.ogc.sld+xml" -d @roads.sld http://localhost:8080/geoserver/rest/styles/roads_style
这个语句转化为requests改怎么写?
试试看
url = 'http://admin:geoserver@localhost:8080/geoserver/rest/styles/roads_style'
headers = {
'Content-type': 'application/vnd.ogc.sld+xml'
}
data = open('roads.sldon’)
response = request.post(url, data=data, headers=headers)