Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I wrote the following command in Geoserver rest-api using curl:

cmd=curl -v -u admin:geoserver -XGET -H "Accept: text/xml" http://localhost:8080/geoserver/rest/workspaces/myworkspace/datastores/mydatastore/featuretypes?list=available   

I want to execute this command through python like os.system(cmd).
Now How can I get the list in python itself.
I tried as follow:

import subprocess
import os
from subprocess import Popen,PIPE,STDOUT,call
cmd=r"""curl -v -u admin:geoserver -XGET -H "Accept: text/xml" http://localhost:8080/geoserver/rest/workspaces/myworkspace/datastores/mydatastore/featuretypes?list=available"""  
print output
share|improve this question
up vote 1 down vote accepted

I would advice using a library for using REST from python, eg requests

r = requests.get('http://localhost:8080/geoserver/rest/workspaces/myworkspace/datastores/mydatastore/featuretypes?list=available', auth=('admin', 'geoserver'))

then use r.text or r.json

share|improve this answer

it is recommended to use

cmd must be a list, so you should write it like :

cmdlist= ["curl", "-v", "-u", "admin:geoserver", "-XGET" ,"-H", "Accept: text/xml", "http//jdkjdf"]   

note that you can use .split(" ") to create the list based on your variable cmd

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.