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.
- geobox/__init__.py +61 -63
- geobox/aio/__init__.py +61 -63
- geobox/aio/api.py +489 -473
- geobox/aio/apikey.py +263 -263
- geobox/aio/attachment.py +341 -339
- geobox/aio/base.py +261 -262
- geobox/aio/basemap.py +196 -196
- geobox/aio/dashboard.py +340 -342
- geobox/aio/feature.py +23 -33
- geobox/aio/field.py +315 -321
- geobox/aio/file.py +72 -72
- geobox/aio/layout.py +340 -341
- geobox/aio/log.py +23 -23
- geobox/aio/map.py +1033 -1034
- geobox/aio/model3d.py +415 -415
- geobox/aio/mosaic.py +696 -696
- geobox/aio/plan.py +314 -314
- geobox/aio/query.py +693 -693
- geobox/aio/raster.py +907 -869
- geobox/aio/raster_analysis.py +740 -0
- geobox/aio/route.py +4 -4
- geobox/aio/scene.py +340 -342
- geobox/aio/settings.py +18 -18
- geobox/aio/task.py +404 -402
- geobox/aio/tile3d.py +337 -339
- geobox/aio/tileset.py +102 -103
- geobox/aio/usage.py +52 -51
- geobox/aio/user.py +506 -507
- geobox/aio/vector_tool.py +1968 -0
- geobox/aio/vectorlayer.py +315 -306
- geobox/aio/version.py +272 -273
- geobox/aio/view.py +1019 -983
- geobox/aio/workflow.py +340 -341
- geobox/api.py +18 -2
- geobox/apikey.py +262 -262
- geobox/attachment.py +336 -337
- geobox/base.py +384 -384
- geobox/basemap.py +194 -194
- geobox/dashboard.py +339 -341
- geobox/enums.py +432 -348
- geobox/feature.py +5 -5
- geobox/field.py +320 -320
- geobox/file.py +4 -4
- geobox/layout.py +339 -340
- geobox/log.py +4 -4
- geobox/map.py +1031 -1032
- geobox/model3d.py +410 -410
- geobox/mosaic.py +696 -696
- geobox/plan.py +313 -313
- geobox/query.py +691 -691
- geobox/raster.py +907 -863
- geobox/raster_analysis.py +737 -0
- geobox/scene.py +341 -342
- geobox/settings.py +194 -194
- geobox/task.py +399 -400
- geobox/tile3d.py +337 -338
- geobox/tileset.py +4 -4
- geobox/usage.py +3 -3
- geobox/user.py +503 -503
- geobox/vector_tool.py +1968 -0
- geobox/vectorlayer.py +5 -5
- geobox/version.py +272 -272
- geobox/view.py +981 -981
- geobox/workflow.py +338 -339
- {geobox-2.0.1.dist-info → geobox-2.2.0.dist-info}/METADATA +15 -1
- geobox-2.2.0.dist-info/RECORD +72 -0
- geobox-2.0.1.dist-info/RECORD +0 -68
- {geobox-2.0.1.dist-info → geobox-2.2.0.dist-info}/WHEEL +0 -0
- {geobox-2.0.1.dist-info → geobox-2.2.0.dist-info}/licenses/LICENSE +0 -0
- {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
|
|
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
|
-
|
|
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
|
|
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)
|