geobox 2.0.1__py3-none-any.whl → 2.2.0__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.
Files changed (70) hide show
  1. geobox/__init__.py +61 -63
  2. geobox/aio/__init__.py +61 -63
  3. geobox/aio/api.py +489 -473
  4. geobox/aio/apikey.py +263 -263
  5. geobox/aio/attachment.py +341 -339
  6. geobox/aio/base.py +261 -262
  7. geobox/aio/basemap.py +196 -196
  8. geobox/aio/dashboard.py +340 -342
  9. geobox/aio/feature.py +23 -33
  10. geobox/aio/field.py +315 -321
  11. geobox/aio/file.py +72 -72
  12. geobox/aio/layout.py +340 -341
  13. geobox/aio/log.py +23 -23
  14. geobox/aio/map.py +1033 -1034
  15. geobox/aio/model3d.py +415 -415
  16. geobox/aio/mosaic.py +696 -696
  17. geobox/aio/plan.py +314 -314
  18. geobox/aio/query.py +693 -693
  19. geobox/aio/raster.py +907 -869
  20. geobox/aio/raster_analysis.py +740 -0
  21. geobox/aio/route.py +4 -4
  22. geobox/aio/scene.py +340 -342
  23. geobox/aio/settings.py +18 -18
  24. geobox/aio/task.py +404 -402
  25. geobox/aio/tile3d.py +337 -339
  26. geobox/aio/tileset.py +102 -103
  27. geobox/aio/usage.py +52 -51
  28. geobox/aio/user.py +506 -507
  29. geobox/aio/vector_tool.py +1968 -0
  30. geobox/aio/vectorlayer.py +315 -306
  31. geobox/aio/version.py +272 -273
  32. geobox/aio/view.py +1019 -983
  33. geobox/aio/workflow.py +340 -341
  34. geobox/api.py +18 -2
  35. geobox/apikey.py +262 -262
  36. geobox/attachment.py +336 -337
  37. geobox/base.py +384 -384
  38. geobox/basemap.py +194 -194
  39. geobox/dashboard.py +339 -341
  40. geobox/enums.py +432 -348
  41. geobox/feature.py +5 -5
  42. geobox/field.py +320 -320
  43. geobox/file.py +4 -4
  44. geobox/layout.py +339 -340
  45. geobox/log.py +4 -4
  46. geobox/map.py +1031 -1032
  47. geobox/model3d.py +410 -410
  48. geobox/mosaic.py +696 -696
  49. geobox/plan.py +313 -313
  50. geobox/query.py +691 -691
  51. geobox/raster.py +907 -863
  52. geobox/raster_analysis.py +737 -0
  53. geobox/scene.py +341 -342
  54. geobox/settings.py +194 -194
  55. geobox/task.py +399 -400
  56. geobox/tile3d.py +337 -338
  57. geobox/tileset.py +4 -4
  58. geobox/usage.py +3 -3
  59. geobox/user.py +503 -503
  60. geobox/vector_tool.py +1968 -0
  61. geobox/vectorlayer.py +5 -5
  62. geobox/version.py +272 -272
  63. geobox/view.py +981 -981
  64. geobox/workflow.py +338 -339
  65. {geobox-2.0.1.dist-info → geobox-2.2.0.dist-info}/METADATA +15 -1
  66. geobox-2.2.0.dist-info/RECORD +72 -0
  67. geobox-2.0.1.dist-info/RECORD +0 -68
  68. {geobox-2.0.1.dist-info → geobox-2.2.0.dist-info}/WHEEL +0 -0
  69. {geobox-2.0.1.dist-info → geobox-2.2.0.dist-info}/licenses/LICENSE +0 -0
  70. {geobox-2.0.1.dist-info → geobox-2.2.0.dist-info}/top_level.txt +0 -0
geobox/settings.py CHANGED
@@ -1,195 +1,195 @@
1
- from typing import List, Dict, Optional, TYPE_CHECKING
2
- from urllib.parse import urljoin, urlencode
3
-
4
- from .base import Base
5
- from .utils import clean_data
6
- from .enums import MaxLogPolicy, InvalidDataPolicy, LoginFailurePolicy, MaxConcurrentSessionPolicy
7
-
8
-
9
- if TYPE_CHECKING:
10
- from . import GeoboxClient
11
- from .aio import AsyncGeoboxClient
12
- from .aio.settings import SystemSettings as AsyncSystemSettings
13
-
14
-
15
- class SystemSettings(Base):
16
-
17
- BASE_ENDPOINT = 'settings/'
18
-
19
- def __init__(self,
20
- api: 'GeoboxClient',
21
- data: Optional[Dict] = {}):
22
- """
23
- Initialize a System Settings instance.
24
-
25
- Args:
26
- api (GeoboxClient): The GeoboxClient instance for making requests.
27
- data (Dict, optional): The data of the Setting.
28
- """
29
- super().__init__(api, data=data)
30
-
31
-
32
- @property
33
- def max_log_policy(self) -> 'MaxLogPolicy':
34
- """
35
- Get max log policy
36
-
37
- Returns:
38
- MaxLogPolicy: max log policy
39
- """
40
- return MaxLogPolicy(self.data.get('max_log_policy'))
41
-
42
-
43
- @property
44
- def invalid_data_policy(self) -> 'InvalidDataPolicy':
45
- """
46
- Get invalid data policy
47
-
48
- Returns:
49
- InvalidDataPolicy: invalid data policy
50
- """
51
- return InvalidDataPolicy(self.data.get('invalid_data_policy'))
52
-
53
-
54
- @property
55
- def login_failure_policy(self) -> 'LoginFailurePolicy':
56
- """
57
- Get login failure policy
58
-
59
- Returns:
60
- LoginFailurePolicy: login failure policy
61
- """
62
- return LoginFailurePolicy(self.data.get('login_failure_policy'))
63
-
64
-
65
- @property
66
- def max_concurrent_session_policy(self) -> 'MaxConcurrentSessionPolicy':
67
- """
68
- Get max concurrent sessions
69
-
70
- Returns:
71
- MaxConcurrentSessionPolicy: max concurrent sessions
72
- """
73
- return MaxConcurrentSessionPolicy(self.data.get('max_concurrent_session_policy'))
74
-
75
-
76
- def __repr__(self) -> str:
77
- """
78
- Return a string representation of the system setting instance.
79
-
80
- Returns:
81
- str: A string representation of the system setting instance.
82
- """
83
- return "SystemSettings()"
84
-
85
-
86
- @classmethod
87
- def get_system_settings(cls, api: 'GeoboxClient') -> 'SystemSettings':
88
- """
89
- Get System Settings object (Permission Required).
90
-
91
- Args:
92
- api (GeoboxClient): The GeoboxClient instance for making requests.
93
-
94
- Returns:
95
- SystemSetting: the system settings object.
96
-
97
- Example:
98
- >>> from geobox import GeoboxClient
99
- >>> from geobox.setting import SystemSettings
100
- >>> client = GeoboxClient()
101
- >>> setting = SystemSettings.get_system_settings(client)
102
- or
103
- >>> setting = client.get_system_settings()
104
- """
105
- params = clean_data({
106
- 'f': 'json'
107
- })
108
- query_string = urlencode(params)
109
- endpoint = urljoin(cls.BASE_ENDPOINT, f"?{query_string}")
110
- response = api.get(endpoint)
111
- return SystemSettings(api, response)
112
-
113
-
114
- def update(self, **kwargs) -> Dict:
115
- """
116
- Update the system settings.
117
-
118
- Keyword Args:
119
- brand_name (str)
120
- brand_website (str)
121
- max_log (int)
122
- max_log_policy (MaxLogPolicy)
123
- users_can_view_their_own_logs (bool)
124
- max_upload_file_size (int)
125
- invalid_data_policy (InvalidDataPolicy)
126
- max_login_attempts (int)
127
- login_failure_policy (LoginFailurePolicy)
128
- login_attempts_duration (int)
129
- min_password_length (int)
130
- max_concurrent_session (int)
131
- max_concurrent_session_policy (MaxConcurrentSessionPolicy)
132
- session_timeout (int)
133
- allowed_ip_addresses (Dict)
134
- blocked_ip_addresses (Dict)
135
-
136
- Returns:
137
- Dict: The updated system settings data.
138
-
139
- Raises:
140
- ValidationError: If the system settings data is invalid.
141
-
142
- Example:
143
- >>> from geobox import GeoboxClient
144
- >>> from geobox.setting import SystemSettings
145
- >>> client = GeoboxClient()
146
- >>> settings = SystemSetting.get_system_settings(client)
147
- or
148
- >>> settings = client.get_system_settings()
149
- >>> settings.update_system_settings(max_log=100000)
150
- """
151
- data = {
152
- "brand_name": kwargs.get('brand_name'),
153
- "brand_website": kwargs.get('brand_website'),
154
- "max_log": kwargs.get('max_log'),
155
- "max_log_policy": kwargs.get('max_log_policy').value if kwargs.get('max_log_policy') else None,
156
- "max_upload_file_size": kwargs.get('max_upload_file_size'),
157
- "invalid_data_policy": kwargs.get('invalid_data_policy').value if kwargs.get('invalid_data_policy') else None,
158
- "max_login_attempts": kwargs.get('max_login_attempts'),
159
- "login_failure_policy": kwargs.get('login_failure_policy').value if kwargs.get('login_failure_policy') else None,
160
- "login_attempts_duration": kwargs.get('login_attempts_duration'),
161
- "min_password_length": kwargs.get('min_password_length'),
162
- "max_concurrent_session": kwargs.get('max_concurrent_session'),
163
- "max_concurrent_session_policy": kwargs.get('max_concurrent_session_policy').value if kwargs.get('max_concurrent_session_policy') else None,
164
- "session_timeout": kwargs.get('session_timeout'),
165
- "allowed_ip_addresses": kwargs.get('allowed_ip_addresses'),
166
- "blocked_ip_addresses": kwargs.get('blocked_ip_addresses'),
167
-
168
- }
169
- return super()._update(self.BASE_ENDPOINT, data)
170
-
171
-
172
- def to_async(self, async_client: 'AsyncGeoboxClient') -> 'AsyncSystemSettings':
173
- """
174
- Switch to async version of the system settings instance to have access to the async methods
175
-
176
- Args:
177
- async_client (AsyncGeoboxClient): The async version of the GeoboxClient instance for making requests.
178
-
179
- Returns:
180
- geobox.aio.settings.SystemSettings: the async instance of the system settings.
181
-
182
- Example:
183
- >>> from geobox import Geoboxclient
184
- >>> from geobox.aio import AsyncGeoboxClient
185
- >>> from geobox.setting import SystemSettings
186
- >>> client = GeoboxClient()
187
- >>> settings = SystemSetting.get_system_settings(client)
188
- or
189
- >>> settings = client.get_system_settings()
190
- >>> async with AsyncGeoboxClient() as async_client:
191
- >>> async_settings = settings.to_async(async_client)
192
- """
193
- from .aio.settings import SystemSettings as AsyncSystemSettings
194
-
1
+ from typing import List, Dict, Optional, TYPE_CHECKING
2
+ from urllib.parse import urljoin, urlencode
3
+
4
+ from .base import Base
5
+ from .utils import clean_data
6
+ from .enums import MaxLogPolicy, InvalidDataPolicy, LoginFailurePolicy, MaxConcurrentSessionPolicy
7
+
8
+
9
+ if TYPE_CHECKING:
10
+ from . import GeoboxClient
11
+ from .aio import AsyncGeoboxClient
12
+ from .aio.settings import AsyncSystemSettings
13
+
14
+
15
+ class SystemSettings(Base):
16
+
17
+ BASE_ENDPOINT = 'settings/'
18
+
19
+ def __init__(self,
20
+ api: 'GeoboxClient',
21
+ data: Optional[Dict] = {}):
22
+ """
23
+ Initialize a System Settings instance.
24
+
25
+ Args:
26
+ api (GeoboxClient): The GeoboxClient instance for making requests.
27
+ data (Dict, optional): The data of the Setting.
28
+ """
29
+ super().__init__(api, data=data)
30
+
31
+
32
+ @property
33
+ def max_log_policy(self) -> 'MaxLogPolicy':
34
+ """
35
+ Get max log policy
36
+
37
+ Returns:
38
+ MaxLogPolicy: max log policy
39
+ """
40
+ return MaxLogPolicy(self.data.get('max_log_policy'))
41
+
42
+
43
+ @property
44
+ def invalid_data_policy(self) -> 'InvalidDataPolicy':
45
+ """
46
+ Get invalid data policy
47
+
48
+ Returns:
49
+ InvalidDataPolicy: invalid data policy
50
+ """
51
+ return InvalidDataPolicy(self.data.get('invalid_data_policy'))
52
+
53
+
54
+ @property
55
+ def login_failure_policy(self) -> 'LoginFailurePolicy':
56
+ """
57
+ Get login failure policy
58
+
59
+ Returns:
60
+ LoginFailurePolicy: login failure policy
61
+ """
62
+ return LoginFailurePolicy(self.data.get('login_failure_policy'))
63
+
64
+
65
+ @property
66
+ def max_concurrent_session_policy(self) -> 'MaxConcurrentSessionPolicy':
67
+ """
68
+ Get max concurrent sessions
69
+
70
+ Returns:
71
+ MaxConcurrentSessionPolicy: max concurrent sessions
72
+ """
73
+ return MaxConcurrentSessionPolicy(self.data.get('max_concurrent_session_policy'))
74
+
75
+
76
+ def __repr__(self) -> str:
77
+ """
78
+ Return a string representation of the system setting instance.
79
+
80
+ Returns:
81
+ str: A string representation of the system setting instance.
82
+ """
83
+ return "SystemSettings()"
84
+
85
+
86
+ @classmethod
87
+ def get_system_settings(cls, api: 'GeoboxClient') -> 'SystemSettings':
88
+ """
89
+ Get System Settings object (Permission Required).
90
+
91
+ Args:
92
+ api (GeoboxClient): The GeoboxClient instance for making requests.
93
+
94
+ Returns:
95
+ SystemSetting: the system settings object.
96
+
97
+ Example:
98
+ >>> from geobox import GeoboxClient
99
+ >>> from geobox.setting import SystemSettings
100
+ >>> client = GeoboxClient()
101
+ >>> setting = SystemSettings.get_system_settings(client)
102
+ or
103
+ >>> setting = client.get_system_settings()
104
+ """
105
+ params = clean_data({
106
+ 'f': 'json'
107
+ })
108
+ query_string = urlencode(params)
109
+ endpoint = urljoin(cls.BASE_ENDPOINT, f"?{query_string}")
110
+ response = api.get(endpoint)
111
+ return SystemSettings(api, response)
112
+
113
+
114
+ def update(self, **kwargs) -> Dict:
115
+ """
116
+ Update the system settings.
117
+
118
+ Keyword Args:
119
+ brand_name (str)
120
+ brand_website (str)
121
+ max_log (int)
122
+ max_log_policy (MaxLogPolicy)
123
+ users_can_view_their_own_logs (bool)
124
+ max_upload_file_size (int)
125
+ invalid_data_policy (InvalidDataPolicy)
126
+ max_login_attempts (int)
127
+ login_failure_policy (LoginFailurePolicy)
128
+ login_attempts_duration (int)
129
+ min_password_length (int)
130
+ max_concurrent_session (int)
131
+ max_concurrent_session_policy (MaxConcurrentSessionPolicy)
132
+ session_timeout (int)
133
+ allowed_ip_addresses (Dict)
134
+ blocked_ip_addresses (Dict)
135
+
136
+ Returns:
137
+ Dict: The updated system settings data.
138
+
139
+ Raises:
140
+ ValidationError: If the system settings data is invalid.
141
+
142
+ Example:
143
+ >>> from geobox import GeoboxClient
144
+ >>> from geobox.setting import SystemSettings
145
+ >>> client = GeoboxClient()
146
+ >>> settings = SystemSetting.get_system_settings(client)
147
+ or
148
+ >>> settings = client.get_system_settings()
149
+ >>> settings.update_system_settings(max_log=100000)
150
+ """
151
+ data = {
152
+ "brand_name": kwargs.get('brand_name'),
153
+ "brand_website": kwargs.get('brand_website'),
154
+ "max_log": kwargs.get('max_log'),
155
+ "max_log_policy": kwargs.get('max_log_policy').value if kwargs.get('max_log_policy') else None,
156
+ "max_upload_file_size": kwargs.get('max_upload_file_size'),
157
+ "invalid_data_policy": kwargs.get('invalid_data_policy').value if kwargs.get('invalid_data_policy') else None,
158
+ "max_login_attempts": kwargs.get('max_login_attempts'),
159
+ "login_failure_policy": kwargs.get('login_failure_policy').value if kwargs.get('login_failure_policy') else None,
160
+ "login_attempts_duration": kwargs.get('login_attempts_duration'),
161
+ "min_password_length": kwargs.get('min_password_length'),
162
+ "max_concurrent_session": kwargs.get('max_concurrent_session'),
163
+ "max_concurrent_session_policy": kwargs.get('max_concurrent_session_policy').value if kwargs.get('max_concurrent_session_policy') else None,
164
+ "session_timeout": kwargs.get('session_timeout'),
165
+ "allowed_ip_addresses": kwargs.get('allowed_ip_addresses'),
166
+ "blocked_ip_addresses": kwargs.get('blocked_ip_addresses'),
167
+
168
+ }
169
+ return super()._update(self.BASE_ENDPOINT, data)
170
+
171
+
172
+ def to_async(self, async_client: 'AsyncGeoboxClient') -> 'AsyncSystemSettings':
173
+ """
174
+ Switch to async version of the system settings instance to have access to the async methods
175
+
176
+ Args:
177
+ async_client (AsyncGeoboxClient): The async version of the GeoboxClient instance for making requests.
178
+
179
+ Returns:
180
+ AsyncSystemSettings: the async instance of the system settings.
181
+
182
+ Example:
183
+ >>> from geobox import Geoboxclient
184
+ >>> from geobox.aio import AsyncGeoboxClient
185
+ >>> from geobox.setting import SystemSettings
186
+ >>> client = GeoboxClient()
187
+ >>> settings = SystemSetting.get_system_settings(client)
188
+ or
189
+ >>> settings = client.get_system_settings()
190
+ >>> async with AsyncGeoboxClient() as async_client:
191
+ >>> async_settings = settings.to_async(async_client)
192
+ """
193
+ from .aio.settings import AsyncSystemSettings
194
+
195
195
  return AsyncSystemSettings(api=async_client, data=self.data)