Created
March 19, 2022 14:24
-
-
Save mdiener21/775d059e81ad43111caddcd190c58d0d to your computer and use it in GitHub Desktop.
Delete a geoserver layer using the API with Python Requests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
def delete_layer(layer_name): | |
s = requests.Session() | |
GEOSERVER_USER = 'someusername' | |
GEOSERVER_PASS = 'asecretthingy' | |
s.auth = (GEOSERVER_USER, GEOSERVER_PASS) | |
headers_json = {'Content-type': 'application/json', } | |
del_url = "https:/yourgeoserver.com/workspaces/SsmeWorkspaceName/datastores/someDataStoreName/featuretypes/" + layer_name + "?recurse=true" | |
r = s.delete(del_url, headers=headers_json, data={}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ah blog plug to myself, some details are found here: my blog post to as to how to do this