I'm trying connect to geoserver via rest protocol by gsconfig-py3 in python3 ,I get this error, but when I type "http://localhost:8080/geoserver/rest" in browser I can see these items moreover when I click on each of them I can see content of them:

for more information I'm using:

OS LMDE 3 X64 (Debian 9), GeoServer 2.15.0, Python version:3.7.3

Geoserver Configuration API

  • about/manifest
  • about/status
  • about/version
  • fonts
  • index
  • layergroups
  • layers
  • namespaces
  • resource
  • security/acl/catalog
  • security/acl/layers
  • security/acl/rest
  • security/acl/services
  • security/masterpw
  • security/roles
  • security/self/password
  • security/usergroup/groups
  • security/usergroup/users
  • services/wcs/settings
  • services/wfs/settings
  • services/wms/settings
  • settings
  • settings/contact
  • styles
  • templates
  • workspaces

But when I try connect to geoserver via gsconfig-py3 for example below code:

from geoserver.catalog import Catalog
cat = Catalog("http://localhost:8080/geoserver/rest", username='admin', password='geoserver')

I get this error message:

Traceback (most recent call last):
  File "/home/killercode/Desktop/test_version.py", line 3, in <module>
  File "/usr/local/lib/python3.7/site-packages/geoserver/catalog.py", line 945, in get_workspace
    candidates = [w for w in self.get_workspaces() if w.name == name]
  File "/usr/local/lib/python3.7/site-packages/geoserver/catalog.py", line 940, in get_workspaces
    description = self.get_xml(rest_url)
  File "/usr/local/lib/python3.7/site-packages/geoserver/catalog.py", line 158, in get_xml
geoserver.catalog.FailedRequestError: Tried to make a GET request to http://localhost:8080/geoserver/workspaces.xml but got a 404 status code: 
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 404 Not Found</title>
<body><h2>HTTP ERROR 404</h2>
<p>Problem accessing /geoserver/workspaces.xml. Reason:
<pre>    Not Found</pre></p><hr><a href="http://eclipse.org/jetty">Powered by Jetty:// 9.4.12.v20180830</a><hr/>


How I can fix this problem?

1 Answer 1


It appears that gsconfig-py3 is less relaxed about the format of the base URL than gsconfig was. If it doesn't end / it doesn't think to add one for you. so

cat = Catalog("http://localhost:8080/geoserver/rest/", username='admin', password='geoserver')

does work.

I would raise an issue and a fix for this if I was you.

  • yes, you'd right when I add / I didn't get error, thank you
    – Navid
    Apr 22, 2019 at 8:02
  • I'm trying to connect in the same way, with that line above, and if I do print(cat.__dict__) I get: {'_service_url': 'localhost:8080/geoserver/rest', '_session': <requests.sessions.Session object at 0x7f4658408ef0>, '_cache': {}, '_disable_ssl_validation': False, '_username': 'admin', '_version': None, '_password': 'geoserver'}. But if I try to do cat.get_workspace("my_workspace") I get a ConnectionRefusedError: [Errno 111] Connection refused. Do you know why this might happen?
    – Falcoa
    May 29, 2019 at 23:08
  • To make it work I had to use the URL "geoserver:8080/geoserver/rest"
    – Falcoa
    May 31, 2019 at 2:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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