geobox 2.2.5__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.
Files changed (107) hide show
  1. {geobox-2.2.5 → geobox-2.2.6}/PKG-INFO +1 -1
  2. {geobox-2.2.5 → geobox-2.2.6}/geobox/api.py +16 -13
  3. {geobox-2.2.5 → geobox-2.2.6}/geobox.egg-info/PKG-INFO +1 -1
  4. {geobox-2.2.5 → geobox-2.2.6}/pyproject.toml +1 -1
  5. {geobox-2.2.5 → geobox-2.2.6}/tests/test_api.py +3 -3
  6. {geobox-2.2.5 → geobox-2.2.6}/LICENSE +0 -0
  7. {geobox-2.2.5 → geobox-2.2.6}/README.md +0 -0
  8. {geobox-2.2.5 → geobox-2.2.6}/geobox/__init__.py +0 -0
  9. {geobox-2.2.5 → geobox-2.2.6}/geobox/aio/__init__.py +0 -0
  10. {geobox-2.2.5 → geobox-2.2.6}/geobox/aio/api.py +0 -0
  11. {geobox-2.2.5 → geobox-2.2.6}/geobox/aio/apikey.py +0 -0
  12. {geobox-2.2.5 → geobox-2.2.6}/geobox/aio/attachment.py +0 -0
  13. {geobox-2.2.5 → geobox-2.2.6}/geobox/aio/base.py +0 -0
  14. {geobox-2.2.5 → geobox-2.2.6}/geobox/aio/basemap.py +0 -0
  15. {geobox-2.2.5 → geobox-2.2.6}/geobox/aio/dashboard.py +0 -0
  16. {geobox-2.2.5 → geobox-2.2.6}/geobox/aio/feature.py +0 -0
  17. {geobox-2.2.5 → geobox-2.2.6}/geobox/aio/field.py +0 -0
  18. {geobox-2.2.5 → geobox-2.2.6}/geobox/aio/file.py +0 -0
  19. {geobox-2.2.5 → geobox-2.2.6}/geobox/aio/layout.py +0 -0
  20. {geobox-2.2.5 → geobox-2.2.6}/geobox/aio/log.py +0 -0
  21. {geobox-2.2.5 → geobox-2.2.6}/geobox/aio/map.py +0 -0
  22. {geobox-2.2.5 → geobox-2.2.6}/geobox/aio/model3d.py +0 -0
  23. {geobox-2.2.5 → geobox-2.2.6}/geobox/aio/mosaic.py +0 -0
  24. {geobox-2.2.5 → geobox-2.2.6}/geobox/aio/plan.py +0 -0
  25. {geobox-2.2.5 → geobox-2.2.6}/geobox/aio/query.py +0 -0
  26. {geobox-2.2.5 → geobox-2.2.6}/geobox/aio/raster.py +0 -0
  27. {geobox-2.2.5 → geobox-2.2.6}/geobox/aio/raster_analysis.py +0 -0
  28. {geobox-2.2.5 → geobox-2.2.6}/geobox/aio/route.py +0 -0
  29. {geobox-2.2.5 → geobox-2.2.6}/geobox/aio/scene.py +0 -0
  30. {geobox-2.2.5 → geobox-2.2.6}/geobox/aio/settings.py +0 -0
  31. {geobox-2.2.5 → geobox-2.2.6}/geobox/aio/task.py +0 -0
  32. {geobox-2.2.5 → geobox-2.2.6}/geobox/aio/tile3d.py +0 -0
  33. {geobox-2.2.5 → geobox-2.2.6}/geobox/aio/tileset.py +0 -0
  34. {geobox-2.2.5 → geobox-2.2.6}/geobox/aio/usage.py +0 -0
  35. {geobox-2.2.5 → geobox-2.2.6}/geobox/aio/user.py +0 -0
  36. {geobox-2.2.5 → geobox-2.2.6}/geobox/aio/vector_tool.py +0 -0
  37. {geobox-2.2.5 → geobox-2.2.6}/geobox/aio/vectorlayer.py +0 -0
  38. {geobox-2.2.5 → geobox-2.2.6}/geobox/aio/version.py +0 -0
  39. {geobox-2.2.5 → geobox-2.2.6}/geobox/aio/view.py +0 -0
  40. {geobox-2.2.5 → geobox-2.2.6}/geobox/aio/workflow.py +0 -0
  41. {geobox-2.2.5 → geobox-2.2.6}/geobox/apikey.py +0 -0
  42. {geobox-2.2.5 → geobox-2.2.6}/geobox/attachment.py +0 -0
  43. {geobox-2.2.5 → geobox-2.2.6}/geobox/base.py +0 -0
  44. {geobox-2.2.5 → geobox-2.2.6}/geobox/basemap.py +0 -0
  45. {geobox-2.2.5 → geobox-2.2.6}/geobox/dashboard.py +0 -0
  46. {geobox-2.2.5 → geobox-2.2.6}/geobox/enums.py +0 -0
  47. {geobox-2.2.5 → geobox-2.2.6}/geobox/exception.py +0 -0
  48. {geobox-2.2.5 → geobox-2.2.6}/geobox/feature.py +0 -0
  49. {geobox-2.2.5 → geobox-2.2.6}/geobox/field.py +0 -0
  50. {geobox-2.2.5 → geobox-2.2.6}/geobox/file.py +0 -0
  51. {geobox-2.2.5 → geobox-2.2.6}/geobox/layout.py +0 -0
  52. {geobox-2.2.5 → geobox-2.2.6}/geobox/log.py +0 -0
  53. {geobox-2.2.5 → geobox-2.2.6}/geobox/map.py +0 -0
  54. {geobox-2.2.5 → geobox-2.2.6}/geobox/model3d.py +0 -0
  55. {geobox-2.2.5 → geobox-2.2.6}/geobox/mosaic.py +0 -0
  56. {geobox-2.2.5 → geobox-2.2.6}/geobox/plan.py +0 -0
  57. {geobox-2.2.5 → geobox-2.2.6}/geobox/query.py +0 -0
  58. {geobox-2.2.5 → geobox-2.2.6}/geobox/raster.py +0 -0
  59. {geobox-2.2.5 → geobox-2.2.6}/geobox/raster_analysis.py +0 -0
  60. {geobox-2.2.5 → geobox-2.2.6}/geobox/route.py +0 -0
  61. {geobox-2.2.5 → geobox-2.2.6}/geobox/scene.py +0 -0
  62. {geobox-2.2.5 → geobox-2.2.6}/geobox/settings.py +0 -0
  63. {geobox-2.2.5 → geobox-2.2.6}/geobox/task.py +0 -0
  64. {geobox-2.2.5 → geobox-2.2.6}/geobox/tile3d.py +0 -0
  65. {geobox-2.2.5 → geobox-2.2.6}/geobox/tileset.py +0 -0
  66. {geobox-2.2.5 → geobox-2.2.6}/geobox/usage.py +0 -0
  67. {geobox-2.2.5 → geobox-2.2.6}/geobox/user.py +0 -0
  68. {geobox-2.2.5 → geobox-2.2.6}/geobox/utils.py +0 -0
  69. {geobox-2.2.5 → geobox-2.2.6}/geobox/vector_tool.py +0 -0
  70. {geobox-2.2.5 → geobox-2.2.6}/geobox/vectorlayer.py +0 -0
  71. {geobox-2.2.5 → geobox-2.2.6}/geobox/version.py +0 -0
  72. {geobox-2.2.5 → geobox-2.2.6}/geobox/view.py +0 -0
  73. {geobox-2.2.5 → geobox-2.2.6}/geobox/workflow.py +0 -0
  74. {geobox-2.2.5 → geobox-2.2.6}/geobox.egg-info/SOURCES.txt +0 -0
  75. {geobox-2.2.5 → geobox-2.2.6}/geobox.egg-info/dependency_links.txt +0 -0
  76. {geobox-2.2.5 → geobox-2.2.6}/geobox.egg-info/requires.txt +0 -0
  77. {geobox-2.2.5 → geobox-2.2.6}/geobox.egg-info/top_level.txt +0 -0
  78. {geobox-2.2.5 → geobox-2.2.6}/setup.cfg +0 -0
  79. {geobox-2.2.5 → geobox-2.2.6}/tests/test_apikey.py +0 -0
  80. {geobox-2.2.5 → geobox-2.2.6}/tests/test_attachment.py +0 -0
  81. {geobox-2.2.5 → geobox-2.2.6}/tests/test_basemap.py +0 -0
  82. {geobox-2.2.5 → geobox-2.2.6}/tests/test_dashboard.py +0 -0
  83. {geobox-2.2.5 → geobox-2.2.6}/tests/test_feature.py +0 -0
  84. {geobox-2.2.5 → geobox-2.2.6}/tests/test_field.py +0 -0
  85. {geobox-2.2.5 → geobox-2.2.6}/tests/test_file.py +0 -0
  86. {geobox-2.2.5 → geobox-2.2.6}/tests/test_layout.py +0 -0
  87. {geobox-2.2.5 → geobox-2.2.6}/tests/test_log.py +0 -0
  88. {geobox-2.2.5 → geobox-2.2.6}/tests/test_map.py +0 -0
  89. {geobox-2.2.5 → geobox-2.2.6}/tests/test_model3d.py +0 -0
  90. {geobox-2.2.5 → geobox-2.2.6}/tests/test_mosaic.py +0 -0
  91. {geobox-2.2.5 → geobox-2.2.6}/tests/test_plan.py +0 -0
  92. {geobox-2.2.5 → geobox-2.2.6}/tests/test_query.py +0 -0
  93. {geobox-2.2.5 → geobox-2.2.6}/tests/test_raster.py +0 -0
  94. {geobox-2.2.5 → geobox-2.2.6}/tests/test_raster_analysis.py +0 -0
  95. {geobox-2.2.5 → geobox-2.2.6}/tests/test_route.py +0 -0
  96. {geobox-2.2.5 → geobox-2.2.6}/tests/test_scene.py +0 -0
  97. {geobox-2.2.5 → geobox-2.2.6}/tests/test_settings.py +0 -0
  98. {geobox-2.2.5 → geobox-2.2.6}/tests/test_task.py +0 -0
  99. {geobox-2.2.5 → geobox-2.2.6}/tests/test_tile3d.py +0 -0
  100. {geobox-2.2.5 → geobox-2.2.6}/tests/test_tileset.py +0 -0
  101. {geobox-2.2.5 → geobox-2.2.6}/tests/test_usage.py +0 -0
  102. {geobox-2.2.5 → geobox-2.2.6}/tests/test_user.py +0 -0
  103. {geobox-2.2.5 → geobox-2.2.6}/tests/test_vector_tool.py +0 -0
  104. {geobox-2.2.5 → geobox-2.2.6}/tests/test_vectorlayer.py +0 -0
  105. {geobox-2.2.5 → geobox-2.2.6}/tests/test_version.py +0 -0
  106. {geobox-2.2.5 → geobox-2.2.6}/tests/test_view.py +0 -0
  107. {geobox-2.2.5 → geobox-2.2.6}/tests/test_workflow.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: geobox
3
- Version: 2.2.5
3
+ Version: 2.2.6
4
4
  Summary: SDK for Geobox's APIs
5
5
  Author-email: Hamid Heydari <heydari.h62@gmail.com>
6
6
  License: MIT
@@ -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
- 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):
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}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: geobox
3
- Version: 2.2.5
3
+ Version: 2.2.6
4
4
  Summary: SDK for Geobox's APIs
5
5
  Author-email: Hamid Heydari <heydari.h62@gmail.com>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "geobox"
7
- version = "2.2.5"
7
+ version = "2.2.6"
8
8
  description = "SDK for Geobox's APIs"
9
9
  authors = [
10
10
  {name = "Hamid Heydari", email = "heydari.h62@gmail.com"}
@@ -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