cecil 0.0.11__py3-none-any.whl → 0.0.13__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.

Potentially problematic release.


This version of cecil might be problematic. Click here for more details.

cecil/client.py CHANGED
@@ -13,11 +13,15 @@ from .models import (
13
13
  DataRequestCreate,
14
14
  Reprojection,
15
15
  ReprojectionCreate,
16
+ RecoverAPIKey,
17
+ RecoverAPIKeyRequest,
18
+ RotateAPIKey,
19
+ RotateAPIKeyRequest,
16
20
  SnowflakeCredentials,
17
21
  )
18
22
 
19
23
  # TODO: find a way to get this version from __about__.py
20
- SDK_VERSION = "0.0.11"
24
+ SDK_VERSION = "0.0.13"
21
25
 
22
26
  # TODO: Documentation (Google style)
23
27
  # TODO: Add HTTP retries
@@ -98,6 +102,19 @@ class Client:
98
102
 
99
103
  return df
100
104
 
105
+ def recover_api_key(self, email: str) -> RecoverAPIKey:
106
+ res = self._post(
107
+ url=f"/v0/recover-api-key",
108
+ model=RecoverAPIKeyRequest(email=email),
109
+ )
110
+
111
+ return RecoverAPIKey(**res)
112
+
113
+ def rotate_api_key(self) -> RotateAPIKey:
114
+ res = self._post(url=f"/v0/rotate-api-key", model=RotateAPIKeyRequest())
115
+
116
+ return RotateAPIKey(**res)
117
+
101
118
  def _request(self, method: str, url: str, **kwargs) -> Dict:
102
119
 
103
120
  self._set_auth()
@@ -119,10 +136,11 @@ class Client:
119
136
  except requests.exceptions.ConnectionError as err:
120
137
  raise ValueError("Connection error") from err
121
138
  except requests.exceptions.HTTPError as err:
122
- if err.response.status_code == 403:
123
- raise ValueError("Authentication error") from err
124
- else:
125
- raise
139
+ message = f"Request failed with status code {err.response.status_code}"
140
+ if err.response.text != "":
141
+ message += f": {err.response.text}"
142
+
143
+ raise ValueError(message) from err
126
144
 
127
145
  def _get(self, url: str, **kwargs) -> Dict:
128
146
  return self._request(method="get", url=url, **kwargs)
cecil/models.py CHANGED
@@ -59,6 +59,25 @@ class DataRequestCreate(BaseModel):
59
59
  dataset_id: str
60
60
 
61
61
 
62
+ class RecoverAPIKey(BaseModel):
63
+ model_config = ConfigDict(alias_generator=to_camel, populate_by_name=True)
64
+ message: str
65
+
66
+
67
+ class RecoverAPIKeyRequest(BaseModel):
68
+ model_config = ConfigDict(alias_generator=to_camel, populate_by_name=True)
69
+ email: str
70
+
71
+
72
+ class RotateAPIKey(BaseModel):
73
+ model_config = ConfigDict(alias_generator=to_camel, populate_by_name=True)
74
+ new_api_key: str
75
+
76
+
77
+ class RotateAPIKeyRequest(BaseModel):
78
+ model_config = ConfigDict(alias_generator=to_camel, populate_by_name=True)
79
+
80
+
62
81
  class Reprojection(BaseModel):
63
82
  model_config = ConfigDict(alias_generator=to_camel, populate_by_name=True)
64
83
  id: str
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: cecil
3
- Version: 0.0.11
3
+ Version: 0.0.13
4
4
  Summary: Python SDK for Cecil Earth
5
5
  License-Expression: MIT
6
6
  License-File: LICENSE.txt
@@ -0,0 +1,7 @@
1
+ cecil/__init__.py,sha256=MF64bwUCd4sm3dvcxZnkb4ujHtxT_KeuXdD0nVieEt4,27
2
+ cecil/client.py,sha256=wgEYWuTZeJv81oiCoNU0rUrDlwnXI1sQFiLLa51BvyI,5070
3
+ cecil/models.py,sha256=6p9AedCDdkK-ptK2r5pc9AKG8rgZHw-YYDvRgXPAQqI,2544
4
+ cecil-0.0.13.dist-info/METADATA,sha256=6Py3ar6ZlMOwaX3zo4TScat1uvcZk2jSECFc8CXmBZM,2677
5
+ cecil-0.0.13.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
6
+ cecil-0.0.13.dist-info/licenses/LICENSE.txt,sha256=mUexcmfYx3bG1VIzAdQTOf_NzStYw6-QkKVdUY_d4i4,1066
7
+ cecil-0.0.13.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- cecil/__init__.py,sha256=MF64bwUCd4sm3dvcxZnkb4ujHtxT_KeuXdD0nVieEt4,27
2
- cecil/client.py,sha256=3e6Y-h4o4cGzHC_3w9EKcwiNukeOe2LNLkL7BDIkLHk,4521
3
- cecil/models.py,sha256=eSkDhHSCJyW9OsOkK7eMYh4BXY5FI1Z_THOLVLcE8QA,2027
4
- cecil-0.0.11.dist-info/METADATA,sha256=4qfewZyGTMHzgMXrfPGIxjvDFPC6vYPt0IUbGwcRY-g,2677
5
- cecil-0.0.11.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
6
- cecil-0.0.11.dist-info/licenses/LICENSE.txt,sha256=mUexcmfYx3bG1VIzAdQTOf_NzStYw6-QkKVdUY_d4i4,1066
7
- cecil-0.0.11.dist-info/RECORD,,
File without changes