geoservercloud 0.3.0.dev2__tar.gz → 0.3.0.dev3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: geoservercloud
3
- Version: 0.3.0.dev2
3
+ Version: 0.3.0.dev3
4
4
  Summary: Lightweight Python client to interact with GeoServer Cloud REST API, GeoServer ACL and OGC services
5
5
  License: BSD-2-Clause
6
6
  Author: Camptocamp
@@ -14,6 +14,8 @@ Classifier: Programming Language :: Python :: 3.11
14
14
  Classifier: Programming Language :: Python :: 3.12
15
15
  Requires-Dist: OWSLib
16
16
  Requires-Dist: requests
17
+ Requires-Dist: types-requests
18
+ Requires-Dist: types-xmltodict
17
19
  Requires-Dist: xmltodict
18
20
  Description-Content-Type: text/markdown
19
21
 
@@ -18,7 +18,7 @@ class GeoServerCloud:
18
18
  self,
19
19
  url: str = "http://localhost:9090/geoserver/cloud/",
20
20
  user: str = "admin",
21
- password: str = "geoserver",
21
+ password: str = "geoserver", # nosec
22
22
  ) -> None:
23
23
 
24
24
  self.url: str = url
@@ -119,14 +119,14 @@ class GeoServerCloud:
119
119
 
120
120
  def set_default_locale_for_service(
121
121
  self, workspace: str, locale: str | None
122
- ) -> None:
122
+ ) -> Response:
123
123
  path: str = self.workspace_wms_settings_path(workspace)
124
124
  data: dict[str, dict[str, Any]] = {
125
125
  "wms": {
126
126
  "defaultLocale": locale,
127
127
  }
128
128
  }
129
- self.put_request(path, json=data)
129
+ return self.put_request(path, json=data)
130
130
 
131
131
  def unset_default_locale_for_service(self, workspace) -> None:
132
132
  self.set_default_locale_for_service(workspace, None)
@@ -455,6 +455,7 @@ class GeoServerCloud:
455
455
  **params,
456
456
  timeout=120,
457
457
  )
458
+ return None
458
459
 
459
460
  def get_feature_info(
460
461
  self,
@@ -483,6 +484,7 @@ class GeoServerCloud:
483
484
  return self.wms.getfeatureinfo(
484
485
  **params,
485
486
  )
487
+ return None
486
488
 
487
489
  def get_legend_graphic(
488
490
  self,
@@ -492,10 +494,11 @@ class GeoServerCloud:
492
494
  style: str | None = None,
493
495
  workspace: str | None = None,
494
496
  ) -> Response:
497
+ path: str
495
498
  if not workspace:
496
499
  path = "/wms"
497
500
  else:
498
- path: str = f"/{workspace}/wms"
501
+ path = f"/{workspace}/wms"
499
502
  params: dict[str, Any] = {
500
503
  "service": "WMS",
501
504
  "version": "1.3.0",
@@ -524,12 +527,13 @@ class GeoServerCloud:
524
527
  row=row,
525
528
  column=column,
526
529
  )
530
+ return None
527
531
 
528
- def create_role(self, role_name: str):
529
- self.post_request(f"/rest/security/roles/role/{role_name}")
532
+ def create_role(self, role_name: str) -> Response:
533
+ return self.post_request(f"/rest/security/roles/role/{role_name}")
530
534
 
531
- def delete_role(self, role_name: str):
532
- self.delete_request(f"/rest/security/roles/role/{role_name}")
535
+ def delete_role(self, role_name: str) -> Response:
536
+ return self.delete_request(f"/rest/security/roles/role/{role_name}")
533
537
 
534
538
  def create_role_if_not_exists(self, role_name: str) -> Response | None:
535
539
  if self.role_exists(role_name):
@@ -2,6 +2,8 @@ from typing import Any
2
2
 
3
3
  import requests
4
4
 
5
+ TIMEOUT = 120
6
+
5
7
 
6
8
  class RestService:
7
9
  def __init__(self, url: str, auth: tuple[str, str]) -> None:
@@ -19,6 +21,7 @@ class RestService:
19
21
  params=params,
20
22
  headers=headers,
21
23
  auth=self.auth,
24
+ timeout=TIMEOUT,
22
25
  )
23
26
  if response.status_code != 404:
24
27
  response.raise_for_status()
@@ -40,6 +43,7 @@ class RestService:
40
43
  json=json,
41
44
  data=data,
42
45
  auth=self.auth,
46
+ timeout=TIMEOUT,
43
47
  )
44
48
  if response.status_code != 409:
45
49
  response.raise_for_status()
@@ -60,6 +64,7 @@ class RestService:
60
64
  json=json,
61
65
  data=data,
62
66
  auth=self.auth,
67
+ timeout=TIMEOUT,
63
68
  )
64
69
  response.raise_for_status()
65
70
  return response
@@ -75,6 +80,7 @@ class RestService:
75
80
  params=params,
76
81
  headers=headers,
77
82
  auth=self.auth,
83
+ timeout=TIMEOUT,
78
84
  )
79
85
  if response.status_code != 404:
80
86
  response.raise_for_status()
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "geoservercloud"
3
- version = "0.3.0.dev2"
3
+ version = "0.3.0.dev3"
4
4
  description = "Lightweight Python client to interact with GeoServer Cloud REST API, GeoServer ACL and OGC services"
5
5
  authors = ["Camptocamp <info@camptocamp.com>"]
6
6
  license = "BSD-2-Clause"
@@ -12,6 +12,8 @@ python = ">=3.9,<4.0"
12
12
  requests = "2.32.3"
13
13
  OWSLib = "0.31.0"
14
14
  xmltodict = "0.13.0"
15
+ types-requests = "2.32.0.20240907"
16
+ types-xmltodict = "0.13.0.3"
15
17
 
16
18
  [tool.poetry.group.dev.dependencies]
17
19
  pytest = "8.3.2"
@@ -43,3 +45,6 @@ fix-shallow-repository = true
43
45
 
44
46
  [tool.poetry-plugin-tweak-dependencies-version]
45
47
  default = "present"
48
+
49
+ [tool.bandit]
50
+ exclude_dirs = ["tests"]