diff --git a/src/geoserverx/_async/gsx.py b/src/geoserverx/_async/gsx.py index 0cafa99..cfe0a5d 100644 --- a/src/geoserverx/_async/gsx.py +++ b/src/geoserverx/_async/gsx.py @@ -45,7 +45,7 @@ class AsyncGeoServerX: username: str = "admin" password: str = "geoserver" url: str = "http://127.0.0.1:8080/geoserver/rest/" - head = {"Content-Type": "application/json"} + headers: dict = {"Content-Type": "application/json"} def __post_init__(self): if not self.username and not self.password and not self.url: @@ -153,7 +153,7 @@ async def create_workspace( responses = await Client.post( f"workspaces?default={default}", data=payload.model_dump_json(), - headers=self.head, + headers=self.headers, ) results = self.response_recognise(responses.status_code) return results @@ -250,7 +250,7 @@ async def create_pg_store( responses = await Client.post( f"workspaces/{workspace}/datastores/", data=payload.model_dump_json(), - headers=self.head, + headers=self.headers, ) results = self.response_recognise(responses.status_code) return results @@ -387,7 +387,7 @@ async def create_geofence(self, rule: Rule) -> GSResponse: responses = await Client.post( "geofence/rules", content=PostingRule.model_dump_json(), - headers=self.head, + headers=self.headers, ) results = self.response_recognise(responses.status_code) return results diff --git a/src/geoserverx/_sync/gsx.py b/src/geoserverx/_sync/gsx.py index 791b1f9..6c43f57 100644 --- a/src/geoserverx/_sync/gsx.py +++ b/src/geoserverx/_sync/gsx.py @@ -48,7 +48,7 @@ class SyncGeoServerX: username: str = "admin" password: str = "geoserver" url: str = "http://127.0.0.1:8080/geoserver/rest/" - head = {"Content-Type": "application/json"} + headers: dict = {"Content-Type": "application/json"} def __post_init__(self): if not self.username and not self.password and not self.url: @@ -171,7 +171,7 @@ def create_workspace( responses = Client.post( f"workspaces?default={default}", content=payload.model_dump_json(), - headers=self.head, + headers=self.headers, ) results = self.response_recognise(responses.status_code) return results @@ -217,7 +217,7 @@ def create_vector_store(self, workspace: str, store: DataStoresModel) -> GSRespo responses = Client.post( f"workspaces/{workspace}/datastores", content=store.model_dump_json(), - headers=self.head, + headers=self.headers, ) results = self.response_recognise(responses.status_code) return results @@ -243,7 +243,7 @@ def create_raster_store( responses = Client.post( f"workspaces/{workspace}/coveragestores", content=store.model_dump_json(), - headers=self.head, + headers=self.headers, ) results = self.response_recognise(responses.status_code) return results @@ -256,11 +256,11 @@ def delete_store( Client = self.http_client if type == "raster": responses = Client.delete( - f"/workspaces/{workspace}/coveragestores/{store}", headers=self.head + f"/workspaces/{workspace}/coveragestores/{store}", headers=self.headers ) elif type == "vector": responses = Client.delete( - f"/workspaces/{workspace}/datastores/{store}", headers=self.head + f"/workspaces/{workspace}/datastores/{store}", headers=self.headers ) results = self.response_recognise(responses.status_code) return results @@ -335,7 +335,7 @@ def create_pg_store( responses = Client.post( f"workspaces/{workspace}/datastores/", data=payload.model_dump_json(), - headers=self.head, + headers=self.headers, ) results = self.response_recognise(responses.status_code) return results @@ -424,7 +424,7 @@ def create_vector_layer( responses = Client.post( f"/workspaces/{workspace}/featuretypes", data=layer.model_dump(by_alias=True, exclude_none=True), - headers=self.head, + headers=self.headers, ) results = self.response_recognise(responses.status_code) return results @@ -435,7 +435,7 @@ def create_raster_layer(self, workspace: str, layer: CoverageModel) -> GSRespons responses = Client.post( f"/workspaces/{workspace}/coverages", data=layer.model_dump_json(), - headers=self.head, + headers=self.headers, ) results = self.response_recognise(responses.status_code) return results @@ -514,7 +514,7 @@ def create_geofence(self, rule: Rule) -> GSResponse: responses = Client.post( "geofence/rules", content=PostingRule.model_dump_json(), - headers=self.head, + headers=self.headers, ) results = self.response_recognise(responses.status_code) return results