geobox 2.2.4__tar.gz → 2.2.6__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.
- {geobox-2.2.4 → geobox-2.2.6}/PKG-INFO +1 -1
- {geobox-2.2.4 → geobox-2.2.6}/geobox/aio/query.py +1 -1
- {geobox-2.2.4 → geobox-2.2.6}/geobox/api.py +16 -13
- {geobox-2.2.4 → geobox-2.2.6}/geobox/enums.py +4 -4
- {geobox-2.2.4 → geobox-2.2.6}/geobox/query.py +1 -1
- {geobox-2.2.4 → geobox-2.2.6}/geobox.egg-info/PKG-INFO +1 -1
- {geobox-2.2.4 → geobox-2.2.6}/pyproject.toml +1 -1
- {geobox-2.2.4 → geobox-2.2.6}/tests/test_api.py +3 -3
- {geobox-2.2.4 → geobox-2.2.6}/LICENSE +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/README.md +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/__init__.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/aio/__init__.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/aio/api.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/aio/apikey.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/aio/attachment.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/aio/base.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/aio/basemap.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/aio/dashboard.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/aio/feature.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/aio/field.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/aio/file.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/aio/layout.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/aio/log.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/aio/map.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/aio/model3d.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/aio/mosaic.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/aio/plan.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/aio/raster.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/aio/raster_analysis.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/aio/route.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/aio/scene.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/aio/settings.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/aio/task.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/aio/tile3d.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/aio/tileset.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/aio/usage.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/aio/user.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/aio/vector_tool.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/aio/vectorlayer.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/aio/version.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/aio/view.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/aio/workflow.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/apikey.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/attachment.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/base.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/basemap.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/dashboard.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/exception.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/feature.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/field.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/file.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/layout.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/log.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/map.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/model3d.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/mosaic.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/plan.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/raster.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/raster_analysis.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/route.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/scene.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/settings.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/task.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/tile3d.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/tileset.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/usage.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/user.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/utils.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/vector_tool.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/vectorlayer.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/version.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/view.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox/workflow.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox.egg-info/SOURCES.txt +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox.egg-info/dependency_links.txt +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox.egg-info/requires.txt +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/geobox.egg-info/top_level.txt +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/setup.cfg +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/tests/test_apikey.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/tests/test_attachment.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/tests/test_basemap.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/tests/test_dashboard.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/tests/test_feature.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/tests/test_field.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/tests/test_file.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/tests/test_layout.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/tests/test_log.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/tests/test_map.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/tests/test_model3d.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/tests/test_mosaic.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/tests/test_plan.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/tests/test_query.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/tests/test_raster.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/tests/test_raster_analysis.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/tests/test_route.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/tests/test_scene.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/tests/test_settings.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/tests/test_task.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/tests/test_tile3d.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/tests/test_tileset.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/tests/test_usage.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/tests/test_user.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/tests/test_vector_tool.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/tests/test_vectorlayer.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/tests/test_version.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/tests/test_view.py +0 -0
- {geobox-2.2.4 → geobox-2.2.6}/tests/test_workflow.py +0 -0
|
@@ -109,7 +109,7 @@ class _RequestSession(requests.Session):
|
|
|
109
109
|
|
|
110
110
|
return original_content_type
|
|
111
111
|
|
|
112
|
-
def request(self, method: str, url: str, **kwargs) -> requests.Response:
|
|
112
|
+
def request(self, method: str, url: str, verify: bool = True, **kwargs) -> requests.Response:
|
|
113
113
|
"""
|
|
114
114
|
Override request method with header management.
|
|
115
115
|
|
|
@@ -136,7 +136,7 @@ class _RequestSession(requests.Session):
|
|
|
136
136
|
kwargs['headers'] = request_headers
|
|
137
137
|
|
|
138
138
|
try:
|
|
139
|
-
response = super().request(method, url, **kwargs)
|
|
139
|
+
response = super().request(method, url, verify=verify, **kwargs)
|
|
140
140
|
finally:
|
|
141
141
|
if original_content_type:
|
|
142
142
|
self.headers['Content-Type'] = original_content_type
|
|
@@ -150,12 +150,14 @@ class GeoboxClient:
|
|
|
150
150
|
"""
|
|
151
151
|
|
|
152
152
|
def __init__(self,
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
153
|
+
host: str = 'https://api.geobox.ir',
|
|
154
|
+
ver: str = 'v1/',
|
|
155
|
+
username: str = None,
|
|
156
|
+
password: str = None,
|
|
157
|
+
access_token: str = None,
|
|
158
|
+
apikey: str = None,
|
|
159
|
+
verify: bool = True,
|
|
160
|
+
):
|
|
159
161
|
"""
|
|
160
162
|
Constructs all the necessary attributes for the Api object.
|
|
161
163
|
|
|
@@ -175,6 +177,7 @@ class GeoboxClient:
|
|
|
175
177
|
password (str, optional): Password for authentication
|
|
176
178
|
access_token (str, optional): Bearer token for authentication
|
|
177
179
|
apikey (str, optional): API key for authentication
|
|
180
|
+
verify (bool, optional): it controls whether to verify the server's TLS certificate. Defaults to True. When set to False, requests will accept any TLS certificate presented by the server, and will ignore hostname mismatches and/or expired certificates, which will make your application vulnerable to man-in-the-middle (MitM) attacks. Setting verify to False may be useful during local development or testing
|
|
178
181
|
|
|
179
182
|
Example:
|
|
180
183
|
>>> from geobox import GeoboxClient
|
|
@@ -188,7 +191,7 @@ class GeoboxClient:
|
|
|
188
191
|
self.password = os.getenv('GEOBOX_PASSWORD') if os.getenv('GEOBOX_PASSWORD') else password
|
|
189
192
|
self.access_token = os.getenv('GEOBOX_ACCESS_TOKEN') if os.getenv('GEOBOX_ACCESS_TOKEN') else access_token
|
|
190
193
|
self.apikey = os.getenv('GEOBOX_APIKEY') if os.getenv('GEOBOX_APIKEY') else apikey
|
|
191
|
-
|
|
194
|
+
self.verify = verify
|
|
192
195
|
self.session = _RequestSession(access_token=self.access_token)
|
|
193
196
|
|
|
194
197
|
host = host.lower()
|
|
@@ -232,7 +235,7 @@ class GeoboxClient:
|
|
|
232
235
|
url = urljoin(self.base_url, "auth/token/")
|
|
233
236
|
data = {"username": self.username, "password": self.password}
|
|
234
237
|
try:
|
|
235
|
-
response = requests.post(url, data=data)
|
|
238
|
+
response = requests.post(url, data=data, verify=self.verify)
|
|
236
239
|
response_data = response.json()
|
|
237
240
|
if response.status_code == 200:
|
|
238
241
|
return response_data["access_token"]
|
|
@@ -328,11 +331,11 @@ class GeoboxClient:
|
|
|
328
331
|
|
|
329
332
|
try:
|
|
330
333
|
if files:
|
|
331
|
-
response = self.session.request(method, url, data=payload, files=files)
|
|
334
|
+
response = self.session.request(method, url, verify=self.verify, data=payload, files=files)
|
|
332
335
|
elif is_json:
|
|
333
|
-
response = self.session.request(method, url, json=payload)
|
|
336
|
+
response = self.session.request(method, url, verify=self.verify, json=payload)
|
|
334
337
|
else:
|
|
335
|
-
response = self.session.request(method, url, data=payload)
|
|
338
|
+
response = self.session.request(method, url, verify=self.verify, data=payload)
|
|
336
339
|
|
|
337
340
|
except requests.exceptions.Timeout as e:
|
|
338
341
|
raise ApiRequestError(f"Request timed out: {e}")
|
|
@@ -3,16 +3,16 @@ from enum import Enum
|
|
|
3
3
|
# File Enums
|
|
4
4
|
class InputGeomType(Enum):
|
|
5
5
|
POINT = 'POINT'
|
|
6
|
-
|
|
6
|
+
LINESTRING = 'LINESTRING'
|
|
7
7
|
POLYGON = 'POLYGON'
|
|
8
8
|
MULTIPOINT = 'MULTIPOINT'
|
|
9
|
-
|
|
9
|
+
MULTILINESTRING = 'MULTILINESTRING'
|
|
10
10
|
MULTIPOLYGON = 'MULTIPOLYGON'
|
|
11
11
|
POINT_Z = 'POINTZ'
|
|
12
|
-
|
|
12
|
+
LINESTRING_Z = 'LINESTRINGZ'
|
|
13
13
|
POLYGON_Z = 'POLYGONZ'
|
|
14
14
|
MULTIPOINT_Z = 'MULTIPOINTZ'
|
|
15
|
-
|
|
15
|
+
MULTILINESTRING_Z = 'MULTILINESTRINGZ'
|
|
16
16
|
MULTIPOLYGON_Z = 'MULTIPOLYGONZ'
|
|
17
17
|
|
|
18
18
|
class PublishFileType(Enum):
|
|
@@ -35,7 +35,7 @@ def test_init_with_username_password(env_vars):
|
|
|
35
35
|
)
|
|
36
36
|
|
|
37
37
|
assert client.access_token == 'test_token'
|
|
38
|
-
mock_post.assert_called_once_with(f'{client.base_url}auth/token/', data={'username': 'test_user', 'password': 'test_pass'})
|
|
38
|
+
mock_post.assert_called_once_with(f'{client.base_url}auth/token/', data={'username': 'test_user', 'password': 'test_pass'}, verify=True)
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
def test_init_with_env_vars(env_vars):
|
|
@@ -52,7 +52,7 @@ def test_init_with_env_vars(env_vars):
|
|
|
52
52
|
assert client.username == 'env_user'
|
|
53
53
|
assert client.password == 'env_pass'
|
|
54
54
|
assert client.access_token == 'env_token'
|
|
55
|
-
mock_post.assert_called_once_with(f'{client.base_url}auth/token/', data={'username': 'env_user', 'password': 'env_pass'})
|
|
55
|
+
mock_post.assert_called_once_with(f'{client.base_url}auth/token/', data={'username': 'env_user', 'password': 'env_pass'}, verify=True)
|
|
56
56
|
|
|
57
57
|
|
|
58
58
|
def test_init_without_credentials(env_vars):
|
|
@@ -74,7 +74,7 @@ def test_get_access_token_success(env_vars):
|
|
|
74
74
|
)
|
|
75
75
|
token = client.get_access_token()
|
|
76
76
|
assert token == 'test_token'
|
|
77
|
-
mock_post.assert_called_with(f'{client.base_url}auth/token/', data={'username': 'test_user', 'password': 'test_pass'})
|
|
77
|
+
mock_post.assert_called_with(f'{client.base_url}auth/token/', data={'username': 'test_user', 'password': 'test_pass'}, verify=True)
|
|
78
78
|
|
|
79
79
|
|
|
80
80
|
def test_get_access_token_failure(env_vars):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|