Skip to main content

GeoServer python REST API client

Project description

gsrest

GeoServer python REST API client.

About

This package is on an early stage, but may be functional for your needs.

At this point, the only documentation is the one on source files and the tests themself.

Features

  • HTTP only. Warning: your geoserver credentials may be publicly exposed.
  • Python >= 3.7.
  • Static setup of the connection for all GeoServer elements.
  • Easily extendable.
  • CLI to upload from YAML (great for automation).
  • Just PyYAML as runtime dependency.

Installation

Download from PyPI:

pip install gsrest

Sample usage

To test the client, you need a geoserver instance. For simplicity, in this example we will use the geoserver docker image from kartoza:

$ docker run -d --rm -p 8080:8080 --name geoserver kartoza/geoserver:2.17.0

Let's setup the client credentials. Default values work fine with the docker instance.

$ python
>>> from gsrest import client
>>> client.GsClient()  # will setup the connection for all elements

Next, let's create a local workspace and sync (upload) it to the server.

>>> from gsrest.elements import workspace
>>> wsp = workspace.WorkSpace("wsp1")
>>> wsp.uri = "http://my.uri/"
>>> wsp.sync()

Then, you can check the new workspace at http://localhost:8080/geoserver (user admin / password geoserver).

Finally, do not forget to kill the docker instance.

$ docker kill geoserver

License

Licensed under the term of GPL-3.0-or-later LICENSE. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gsrest-0.2.1.tar.gz (36.0 kB view hashes)

Uploaded Source

Built Distribution

gsrest-0.2.1-py3-none-any.whl (58.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page