geobox 1.0.0__py3-none-any.whl → 1.1.1__py3-none-any.whl

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/api.py CHANGED
@@ -597,23 +597,23 @@ class GeoboxClient:
597
597
  return File.get_file(self, uuid=uuid)
598
598
 
599
599
 
600
- def get_file_by_name(self, name: str, user_id: int = None) -> Union['File', None]:
600
+ def get_files_by_name(self, name: str, user_id: int = None) -> List['File']:
601
601
  """
602
- Get a file by name
602
+ Get files by name
603
603
 
604
604
  Args:
605
605
  name (str): the name of the file to get
606
606
  user_id (int, optional): specific user. privileges required.
607
607
 
608
608
  Returns:
609
- File | None: returns the file if a file matches the given name, else None
609
+ List[File]: returns files that matches the given name
610
610
 
611
611
  Example:
612
612
  >>> from geobox import GeoboxClient
613
613
  >>> client = GeoboxClient()
614
- >>> file = client.get_file_by_name(name='test')
614
+ >>> files = client.get_files_by_name(name='test')
615
615
  """
616
- return File.get_file_by_name(self, name, user_id)
616
+ return File.get_files_by_name(self, name, user_id)
617
617
 
618
618
 
619
619
  def upload_file(self, path: str, user_id: int = None, scan_archive: bool = True) -> 'File':
geobox/enums.py CHANGED
@@ -30,7 +30,7 @@ class FileType(Enum):
30
30
  GPX = '.gpx'
31
31
  GPKG = '.gpkg'
32
32
  GeoJSON = '.geojson'
33
- GeoTIFF = '.tif'
33
+ GeoTIFF = '.tiff'
34
34
 
35
35
  # Image Formats
36
36
  JPG = '.jpg'
geobox/file.py CHANGED
@@ -188,9 +188,9 @@ class File(Base):
188
188
 
189
189
 
190
190
  @classmethod
191
- def get_file_by_name(cls, api: 'GeoboxClient', name: str, user_id: int = None) -> Union['File', None]:
191
+ def get_files_by_name(cls, api: 'GeoboxClient', name: str, user_id: int = None) -> List['File']:
192
192
  """
193
- Get a file by name
193
+ Get files by name
194
194
 
195
195
  Args:
196
196
  api (GeoboxClient): The GeoboxClient instance for making requests.
@@ -198,21 +198,17 @@ class File(Base):
198
198
  user_id (int, optional): specific user. privileges required.
199
199
 
200
200
  Returns:
201
- File | None: returns the file if a file matches the given name, else None
201
+ List[File]: returns files that matches the given name
202
202
 
203
203
  Example:
204
204
  >>> from geobox import GeoboxClient
205
205
  >>> from geobox.file import File
206
206
  >>> client = GeoboxClient()
207
- >>> file = File.get_file_by_name(client, name='test')
207
+ >>> files = File.get_file_by_name(client, name='test')
208
208
  or
209
- >>> file = client.get_file_by_name(name='test')
209
+ >>> files = client.get_file_by_name(name='test')
210
210
  """
211
- files = cls.get_files(api, q=f"name = '{name}'", user_id=user_id)
212
- if files and files[0].name == name:
213
- return files[0]
214
- else:
215
- return None
211
+ return cls.get_files(api, q=f"name = '{name}'", user_id=user_id)
216
212
 
217
213
 
218
214
  def _get_save_path(self, save_path: str = None) -> str:
geobox/task.py CHANGED
@@ -168,8 +168,31 @@ class Task(Base):
168
168
 
169
169
  return int((current / total) * 100)
170
170
 
171
+
172
+ def _wait(self, timeout: Union[int, None] = None, interval: int = 1, progress_bar: bool = True) -> 'TaskStatus':
173
+ start_time = time.time()
174
+ last_progress = 0
175
+ pbar = self._create_progress_bar() if progress_bar else None
176
+
177
+ try:
178
+ while True:
179
+ self._check_timeout(start_time, timeout)
180
+ status = self.status
181
+
182
+ if self._is_final_state(status):
183
+ self._update_progress_bar(pbar, last_progress, status)
184
+ return TaskStatus(status)
185
+
186
+ if pbar:
187
+ last_progress = self._update_progress_bar(pbar, last_progress)
188
+
189
+ time.sleep(interval)
190
+ finally:
191
+ if pbar:
192
+ pbar.close()
171
193
 
172
- def wait(self, timeout: Union[int, None] = None, interval: int = 1, progress_bar: bool = True) -> 'TaskStatus':
194
+
195
+ def wait(self, timeout: Union[int, None] = None, interval: int = 1, progress_bar: bool = True, retry: int = 3) -> 'TaskStatus':
173
196
  """
174
197
  Wait for the task to finish.
175
198
 
@@ -177,6 +200,7 @@ class Task(Base):
177
200
  timeout (int, optional): Maximum time to wait in seconds.
178
201
  interval (int, optional): Time between status checks in seconds.
179
202
  progress_bar (bool, optional): Whether to show a progress bar. default: True
203
+ retry (int, optional): Number of times to retry if waiting for the task fails. default is 3
180
204
 
181
205
  Returns:
182
206
  TaskStatus: the status of the task(SUCCESS, FAILURE, ABORTED, PENDING, PROGRESS)
@@ -191,26 +215,16 @@ class Task(Base):
191
215
  >>> task = Task.get_task(client, uuid="12345678-1234-5678-1234-567812345678")
192
216
  >>> task.wait() # return the status of the task
193
217
  """
194
- start_time = time.time()
195
- last_progress = 0
196
- pbar = self._create_progress_bar() if progress_bar else None
197
-
198
- try:
199
- while True:
200
- self._check_timeout(start_time, timeout)
201
- status = self.status
202
-
203
- if self._is_final_state(status):
204
- self._update_progress_bar(pbar, last_progress, status)
205
- return TaskStatus(status)
206
-
207
- if pbar:
208
- last_progress = self._update_progress_bar(pbar, last_progress)
209
-
218
+ last_exception = None
219
+
220
+ for attempt in range(1, retry + 1):
221
+ try:
222
+ return self._wait(timeout, interval, progress_bar)
223
+ except Exception as e:
224
+ last_exception = e
225
+ print(f"[Retry {attempt}/{retry}] Task wait failed: {e}")
210
226
  time.sleep(interval)
211
- finally:
212
- if pbar:
213
- pbar.close()
227
+ raise last_exception
214
228
 
215
229
 
216
230
  def _create_progress_bar(self) -> 'tqdm':
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: geobox
3
- Version: 1.0.0
3
+ Version: 1.1.1
4
4
  Summary: SDK for Geobox's APIs
5
5
  Author-email: Hamid Heydari <heydari.h62@gmail.com>
6
6
  License: MIT
@@ -29,7 +29,7 @@ Dynamic: license-file
29
29
 
30
30
  Geobox® is a cloud-based GIS platform that enables users (local governments, companies and individuals) to easily upload their geo-spatial data, publish them as geo-services, visualize and analyze their geo-content (geo-data or -services) and share them with others. Geobox is a modern, world-class and cloud-ready geo-spatial platform that provides standard, safe, efficient and easy to use GI-Services.
31
31
 
32
- Geobox SDK provides seamless integration with the Geobox API, enabling developers to work with geospatial data and services programmatically. This comprehensive toolkit empowers applications to leverage advanced geospatial capabilities including data management and analysis.
32
+ Geobox python SDK provides seamless integration with the Geobox API, enabling developers to work with geospatial data and services programmatically. This comprehensive toolkit empowers applications to leverage advanced geospatial capabilities including data management and analysis.
33
33
 
34
34
  Installation
35
35
  ============
@@ -1,15 +1,15 @@
1
1
  geobox/__init__.py,sha256=iRkJAFIjMXiAaLTVXvZcW5HM7ttyipGdxFZ15NCM8qU,1895
2
- geobox/api.py,sha256=sLnq3B15UCgit_3PMMxKDnTI7hG7QykZK0uliu6Gu3A,100562
2
+ geobox/api.py,sha256=Sq9iKYltgdR96cA4w5_5jMraNqAUpgSzMriO9PbZFNA,100538
3
3
  geobox/apikey.py,sha256=FBio1PtGovAUaTE0HW9IJ55UuFdR_1ICk_FQhHu5dAE,7427
4
4
  geobox/attachment.py,sha256=XbGwfWWuFAMimj4tsjKBvlSLP-rhpNACCtxgRmUvcdY,11631
5
5
  geobox/base.py,sha256=p0UVZo9CINw0mW9o0nNR_VNCk7V1r-FrLQ_NH39WARE,12299
6
6
  geobox/basemap.py,sha256=fDWwkMf-F2NTE1tVLijoxQku55825b6gj8nk69TMOII,4386
7
7
  geobox/dashboard.py,sha256=MYyT3YJEGPCbTXHcYoZmn14rFOaut1J3idEA8bCdFgI,11762
8
- geobox/enums.py,sha256=sNBtHlpCs7jIqIsLrdNtyThVZ2Mbsx_Cj7oxI1U5G5w,6267
8
+ geobox/enums.py,sha256=SVUmz_Z4PrPSauutULb3lzrEwNuGJ2qa_DRgpz7n5qo,6268
9
9
  geobox/exception.py,sha256=jvpnv0M2Ck1FpxHTL_aKYWxGvLnCQ3d9vOrMIktjw1U,1507
10
10
  geobox/feature.py,sha256=3Kbc1LjIkBt1YqRAry84BrR7qxx9BexvBB3YQ8D9mGk,18504
11
11
  geobox/field.py,sha256=2VxjeYgRwnDxHYpAsK0ASOCz8V0JmfTA3GqHDv3rfgQ,10526
12
- geobox/file.py,sha256=4nlvQ6FBqOJ4WpsZYs5QnAq8hZfcD_f9KOaUFluhoxs,18610
12
+ geobox/file.py,sha256=YlBrX8apx-4Z0QutZq9fdoVqdfqqQop0UdHdzr6daII,18474
13
13
  geobox/log.py,sha256=ZTmVErhyAszf7M5YFxT5mqXNNDGPnRwXPeGLDS1G6PE,3582
14
14
  geobox/map.py,sha256=98P1gbB5U_eu71Hu6EQ0kL_ponbPAnoOCitjEa35q4I,31307
15
15
  geobox/model3d.py,sha256=qRYCx-q9LpGhdu5oz3av0uUoiDimuk4BvXXwMW5bo9Q,12061
@@ -20,7 +20,7 @@ geobox/raster.py,sha256=9Qnv9CQvgVxuNx1khDPQhHZEcopXofIPYBnRrx40FVk,26495
20
20
  geobox/route.py,sha256=cKZTTHBHM8woWbhHIpCvrRX_doJcTkGktouee0z7oG0,2723
21
21
  geobox/scene.py,sha256=Sz2tiyJk-bXYjktfcp1d2gGrW3gt2T4D1FAMoRHOCng,11369
22
22
  geobox/settings.py,sha256=rGRdM18Vo7xnjfZXPLRMbKeoVC_lZmzkNRPS0SQv05o,5660
23
- geobox/task.py,sha256=0X4PbKRkHz-M1l9RMZzQ-JezOf0J7ygpmwim9FGqJW4,12752
23
+ geobox/task.py,sha256=lACZ-ix3BAAU1-pNnbHC2noAtt79swrkmkCczEO7D2A,13364
24
24
  geobox/tile3d.py,sha256=MHDoj2OIUf3VMQtq7ysrayh8njAPSgwgPJCm4ySEB7A,10472
25
25
  geobox/tileset.py,sha256=F_oEV0TERMc2seLcYNu-i_TF4MNSdXPUWcxBCSR8aFw,22242
26
26
  geobox/usage.py,sha256=_54xL-n-2Bg9wGpoOBKnh85WqdpMWEtqxRJVaFlVWe0,7908
@@ -30,8 +30,8 @@ geobox/vectorlayer.py,sha256=xnYsJei-bpKgM_EJlRbZ-bAIHdmvfU-VZ2t-NEEJCfc,49420
30
30
  geobox/version.py,sha256=0GLPhxCeEb2bAkdpPJWtXPXc1KP6kQ_TOMwLAL0ldo0,9374
31
31
  geobox/view.py,sha256=fRYlzNu4eGl6Zx9gPom47BkVE8DfWLj0bNlW2-u4TOU,37390
32
32
  geobox/workflow.py,sha256=6hKnSw4G0_ZlgmUb0g3fxT-UVsFbiYpF2FbEO5fpQv0,11606
33
- geobox-1.0.0.dist-info/licenses/LICENSE,sha256=AvFB7W94sJYKLDhBxLRshL3upexCOG8HQY_1JibB96w,1063
34
- geobox-1.0.0.dist-info/METADATA,sha256=YrdDPLOnpVmt6SB3z4zcjlhLZ-IDPGamXOkiXPPhOR4,2549
35
- geobox-1.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
36
- geobox-1.0.0.dist-info/top_level.txt,sha256=ppXH8Bu2mlB-pLQ6lsoWEm2Gr6wZx1uzkhetsYA5ins,7
37
- geobox-1.0.0.dist-info/RECORD,,
33
+ geobox-1.1.1.dist-info/licenses/LICENSE,sha256=AvFB7W94sJYKLDhBxLRshL3upexCOG8HQY_1JibB96w,1063
34
+ geobox-1.1.1.dist-info/METADATA,sha256=H10IZAEE-owFW1GSsxbwh-f80oe4HSp9NW2l4Qi2UYE,2556
35
+ geobox-1.1.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
36
+ geobox-1.1.1.dist-info/top_level.txt,sha256=ppXH8Bu2mlB-pLQ6lsoWEm2Gr6wZx1uzkhetsYA5ins,7
37
+ geobox-1.1.1.dist-info/RECORD,,
File without changes