terrakio-core 0.2.1__tar.gz → 0.2.3__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.

Potentially problematic release.


This version of terrakio-core might be problematic. Click here for more details.

@@ -1,9 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: terrakio-core
3
- Version: 0.2.1
3
+ Version: 0.2.3
4
4
  Summary: Core components for Terrakio API clients
5
- Home-page: https://github.com/HaizeaAnalytics/terrakio-python-api
6
- Author: Yupeng Chao
7
5
  Author-email: Yupeng Chao <yupeng@haizea.com.au>
8
6
  Project-URL: Homepage, https://github.com/HaizeaAnalytics/terrakio-python-api
9
7
  Project-URL: Bug Tracker, https://github.com/HaizeaAnalytics/terrakio-python-api/issues
@@ -15,16 +13,14 @@ Classifier: Programming Language :: Python :: 3.10
15
13
  Classifier: License :: OSI Approved :: MIT License
16
14
  Classifier: Operating System :: OS Independent
17
15
  Classifier: Development Status :: 4 - Beta
18
- Requires-Python: >=3.7
16
+ Requires-Python: >3.11
19
17
  Description-Content-Type: text/markdown
20
18
  Requires-Dist: requests>=2.25.0
21
19
  Requires-Dist: aiohttp>=3.8.0
22
20
  Requires-Dist: pyyaml>=5.1
23
21
  Requires-Dist: xarray>=2023.1.0
24
22
  Requires-Dist: shapely>=2.0.0
25
- Dynamic: author
26
- Dynamic: home-page
27
- Dynamic: requires-python
23
+ Requires-Dist: geopandas>=0.13.0
28
24
 
29
25
  # Terrakio Core
30
26
 
@@ -4,13 +4,13 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "terrakio-core"
7
- version = "0.2.1"
7
+ version = "0.2.3"
8
8
  authors = [
9
9
  {name = "Yupeng Chao", email = "yupeng@haizea.com.au"},
10
10
  ]
11
11
  description = "Core components for Terrakio API clients"
12
12
  readme = "README.md"
13
- requires-python = ">=3.7"
13
+ requires-python = ">3.11"
14
14
  classifiers = [
15
15
  "Programming Language :: Python :: 3",
16
16
  "Programming Language :: Python :: 3.7",
@@ -27,6 +27,7 @@ dependencies = [
27
27
  "pyyaml>=5.1",
28
28
  "xarray>=2023.1.0",
29
29
  "shapely>=2.0.0",
30
+ "geopandas>=0.13.0",
30
31
  ]
31
32
 
32
33
  [project.urls]
@@ -1,9 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: terrakio-core
3
- Version: 0.2.1
3
+ Version: 0.2.3
4
4
  Summary: Core components for Terrakio API clients
5
- Home-page: https://github.com/HaizeaAnalytics/terrakio-python-api
6
- Author: Yupeng Chao
7
5
  Author-email: Yupeng Chao <yupeng@haizea.com.au>
8
6
  Project-URL: Homepage, https://github.com/HaizeaAnalytics/terrakio-python-api
9
7
  Project-URL: Bug Tracker, https://github.com/HaizeaAnalytics/terrakio-python-api/issues
@@ -15,16 +13,14 @@ Classifier: Programming Language :: Python :: 3.10
15
13
  Classifier: License :: OSI Approved :: MIT License
16
14
  Classifier: Operating System :: OS Independent
17
15
  Classifier: Development Status :: 4 - Beta
18
- Requires-Python: >=3.7
16
+ Requires-Python: >3.11
19
17
  Description-Content-Type: text/markdown
20
18
  Requires-Dist: requests>=2.25.0
21
19
  Requires-Dist: aiohttp>=3.8.0
22
20
  Requires-Dist: pyyaml>=5.1
23
21
  Requires-Dist: xarray>=2023.1.0
24
22
  Requires-Dist: shapely>=2.0.0
25
- Dynamic: author
26
- Dynamic: home-page
27
- Dynamic: requires-python
23
+ Requires-Dist: geopandas>=0.13.0
28
24
 
29
25
  # Terrakio Core
30
26
 
@@ -0,0 +1,7 @@
1
+ README.md
2
+ pyproject.toml
3
+ terrakio_core.egg-info/PKG-INFO
4
+ terrakio_core.egg-info/SOURCES.txt
5
+ terrakio_core.egg-info/dependency_links.txt
6
+ terrakio_core.egg-info/requires.txt
7
+ terrakio_core.egg-info/top_level.txt
@@ -3,3 +3,4 @@ aiohttp>=3.8.0
3
3
  pyyaml>=5.1
4
4
  xarray>=2023.1.0
5
5
  shapely>=2.0.0
6
+ geopandas>=0.13.0
@@ -1,29 +0,0 @@
1
- from setuptools import setup, find_packages # Make sure to import find_packages
2
-
3
- setup(
4
- name="terrakio_core",
5
- version="0.2.1",
6
- author="Yupeng Chao",
7
- author_email="yupeng@haizea.com.au",
8
- description="Core components for Terrakio API clients",
9
- url="https://github.com/HaizeaAnalytics/terrakio-python-api",
10
- packages = find_packages(),
11
- classifiers=[
12
- "Programming Language :: Python :: 3",
13
- "Programming Language :: Python :: 3.7",
14
- "Programming Language :: Python :: 3.8",
15
- "Programming Language :: Python :: 3.9",
16
- "Programming Language :: Python :: 3.10",
17
- "License :: OSI Approved :: MIT License",
18
- "Operating System :: OS Independent",
19
- "Development Status :: 4 - Beta",
20
- ],
21
- python_requires=">=3.7",
22
- install_requires=[
23
- "requests>=2.25.0",
24
- "pyyaml>=5.1",
25
- "xarray>=2023.1.0",
26
- "shapely>=2.0.0",
27
- ],
28
- metadata_version='2.2'
29
- )
File without changes
@@ -1,237 +0,0 @@
1
- import requests
2
- from typing import Optional, Dict, Any
3
- from .exceptions import APIError, ConfigurationError
4
-
5
- class AuthClient:
6
- def __init__(self, base_url: str = "https://dev-au.terrak.io",
7
- verify: bool = True, timeout: int = 60):
8
- """
9
- Initialize the Authentication Client for Terrakio API.
10
-
11
- Args:
12
- base_url: Authentication API base URL
13
- verify: Verify SSL certificates
14
- timeout: Request timeout in seconds
15
- """
16
- self.base_url = base_url.rstrip('/')
17
- self.verify = verify
18
- self.timeout = timeout
19
- self.session = requests.Session()
20
- self.session.headers.update({
21
- 'Content-Type': 'application/json'
22
- })
23
- self.token = None
24
- self.api_key = None
25
-
26
- def signup(self, email: str, password: str) -> Dict[str, Any]:
27
- """
28
- Register a new user account.
29
-
30
- Args:
31
- email: User email address
32
- password: User password
33
-
34
- Returns:
35
- API response data
36
-
37
- Raises:
38
- APIError: If signup fails
39
- """
40
- endpoint = f"{self.base_url}/users/signup"
41
-
42
- payload = {
43
- "email": email,
44
- "password": password
45
- }
46
-
47
- try:
48
- response = self.session.post(
49
- endpoint,
50
- json=payload,
51
- verify=self.verify,
52
- timeout=self.timeout
53
- )
54
-
55
- if not response.ok:
56
- error_msg = f"Signup failed: {response.status_code} {response.reason}"
57
- try:
58
- error_data = response.json()
59
- if "detail" in error_data:
60
- error_msg += f" - {error_data['detail']}"
61
- except:
62
- pass
63
- raise APIError(error_msg)
64
-
65
- return response.json()
66
- except requests.RequestException as e:
67
- raise APIError(f"Signup request failed: {str(e)}")
68
-
69
- def login(self, email: str, password: str) -> str:
70
- """
71
- Log in and obtain authentication token.
72
-
73
- Args:
74
- email: User email address
75
- password: User password
76
-
77
- Returns:
78
- Authentication token
79
-
80
- Raises:
81
- APIError: If login fails
82
- """
83
- endpoint = f"{self.base_url}/users/login"
84
-
85
- payload = {
86
- "email": email,
87
- "password": password
88
- }
89
-
90
- try:
91
- response = self.session.post(
92
- endpoint,
93
- json=payload,
94
- verify=self.verify,
95
- timeout=self.timeout
96
- )
97
-
98
- if not response.ok:
99
- error_msg = f"Login failed: {response.status_code} {response.reason}"
100
- try:
101
- error_data = response.json()
102
- if "detail" in error_data:
103
- error_msg += f" - {error_data['detail']}"
104
- except:
105
- pass
106
- raise APIError(error_msg)
107
-
108
- result = response.json()
109
- self.token = result.get("token")
110
-
111
- # Update session with authorization header
112
- if self.token:
113
- self.session.headers.update({
114
- "Authorization": self.token
115
- })
116
-
117
- return self.token
118
- except requests.RequestException as e:
119
- raise APIError(f"Login request failed: {str(e)}")
120
-
121
- def refresh_api_key(self) -> str:
122
- """
123
- Generate or refresh API key.
124
-
125
- Returns:
126
- API key
127
-
128
- Raises:
129
- ConfigurationError: If not authenticated
130
- APIError: If refresh fails
131
- """
132
- if not self.token:
133
- raise ConfigurationError("Not authenticated. Call login() first.")
134
-
135
- endpoint = f"{self.base_url}/users/refresh_key"
136
-
137
- try:
138
- # Use session with updated headers from login
139
- response = self.session.post(
140
- endpoint,
141
- verify=self.verify,
142
- timeout=self.timeout
143
- )
144
-
145
- if not response.ok:
146
- error_msg = f"API key generation failed: {response.status_code} {response.reason}"
147
- try:
148
- error_data = response.json()
149
- if "detail" in error_data:
150
- error_msg += f" - {error_data['detail']}"
151
- except:
152
- pass
153
- raise APIError(error_msg)
154
-
155
- result = response.json()
156
- self.api_key = result.get("apiKey")
157
- return self.api_key
158
- except requests.RequestException as e:
159
- raise APIError(f"API key refresh request failed: {str(e)}")
160
-
161
- def view_api_key(self) -> str:
162
- """
163
- Retrieve current API key.
164
-
165
- Returns:
166
- API key
167
-
168
- Raises:
169
- ConfigurationError: If not authenticated
170
- APIError: If retrieval fails
171
- """
172
- if not self.token:
173
- raise ConfigurationError("Not authenticated. Call login() first.")
174
-
175
- endpoint = f"{self.base_url}/users/key"
176
-
177
- try:
178
- # Use session with updated headers from login
179
- response = self.session.get(
180
- endpoint,
181
- verify=self.verify,
182
- timeout=self.timeout
183
- )
184
-
185
- if not response.ok:
186
- error_msg = f"Failed to retrieve API key: {response.status_code} {response.reason}"
187
- try:
188
- error_data = response.json()
189
- if "detail" in error_data:
190
- error_msg += f" - {error_data['detail']}"
191
- except:
192
- pass
193
- raise APIError(error_msg)
194
-
195
- result = response.json()
196
- self.api_key = result.get("apiKey")
197
- return self.api_key
198
- except requests.RequestException as e:
199
- raise APIError(f"API key retrieval request failed: {str(e)}")
200
-
201
- def get_user_info(self) -> Dict[str, Any]:
202
- """
203
- Retrieve the current user's information.
204
-
205
- Returns:
206
- User information data
207
-
208
- Raises:
209
- ConfigurationError: If not authenticated
210
- APIError: If retrieval fails
211
- """
212
- if not self.token:
213
- raise ConfigurationError("Not authenticated. Call login() first.")
214
-
215
- endpoint = f"{self.base_url}/users/info"
216
-
217
- try:
218
- # Use session with updated headers from login
219
- response = self.session.get(
220
- endpoint,
221
- verify=self.verify,
222
- timeout=self.timeout
223
- )
224
-
225
- if not response.ok:
226
- error_msg = f"Failed to retrieve user info: {response.status_code} {response.reason}"
227
- try:
228
- error_data = response.json()
229
- if "detail" in error_data:
230
- error_msg += f" - {error_data['detail']}"
231
- except:
232
- pass
233
- raise APIError(error_msg)
234
-
235
- return response.json()
236
- except requests.RequestException as e:
237
- raise APIError(f"User info retrieval request failed: {str(e)}")