tobiko-cloud-api-client 202508.58.0__tar.gz → 202508.60.0__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (20) hide show
  1. {tobiko_cloud_api_client-202508.58.0/tobiko_cloud_api_client.egg-info → tobiko_cloud_api_client-202508.60.0}/PKG-INFO +2 -2
  2. {tobiko_cloud_api_client-202508.58.0 → tobiko_cloud_api_client-202508.60.0}/setup.py +2 -2
  3. {tobiko_cloud_api_client-202508.58.0 → tobiko_cloud_api_client-202508.60.0/tobiko_cloud_api_client.egg-info}/PKG-INFO +2 -2
  4. {tobiko_cloud_api_client-202508.58.0 → tobiko_cloud_api_client-202508.60.0}/tobiko_cloud_api_client.egg-info/requires.txt +1 -1
  5. {tobiko_cloud_api_client-202508.58.0 → tobiko_cloud_api_client-202508.60.0}/tobikodata/http_client/auth.py +29 -6
  6. {tobiko_cloud_api_client-202508.58.0 → tobiko_cloud_api_client-202508.60.0}/MANIFEST.in +0 -0
  7. {tobiko_cloud_api_client-202508.58.0 → tobiko_cloud_api_client-202508.60.0}/backend_shim.py +0 -0
  8. {tobiko_cloud_api_client-202508.58.0 → tobiko_cloud_api_client-202508.60.0}/setup.cfg +0 -0
  9. {tobiko_cloud_api_client-202508.58.0 → tobiko_cloud_api_client-202508.60.0}/tobiko_cloud_api_client.egg-info/SOURCES.txt +0 -0
  10. {tobiko_cloud_api_client-202508.58.0 → tobiko_cloud_api_client-202508.60.0}/tobiko_cloud_api_client.egg-info/dependency_links.txt +0 -0
  11. {tobiko_cloud_api_client-202508.58.0 → tobiko_cloud_api_client-202508.60.0}/tobiko_cloud_api_client.egg-info/namespace_packages.txt +0 -0
  12. {tobiko_cloud_api_client-202508.58.0 → tobiko_cloud_api_client-202508.60.0}/tobiko_cloud_api_client.egg-info/top_level.txt +0 -0
  13. {tobiko_cloud_api_client-202508.58.0 → tobiko_cloud_api_client-202508.60.0}/tobikodata/__init__.py +0 -0
  14. {tobiko_cloud_api_client-202508.58.0 → tobiko_cloud_api_client-202508.60.0}/tobikodata/http_client/__init__.py +0 -0
  15. {tobiko_cloud_api_client-202508.58.0 → tobiko_cloud_api_client-202508.60.0}/tobikodata/http_client/api.py +0 -0
  16. {tobiko_cloud_api_client-202508.58.0 → tobiko_cloud_api_client-202508.60.0}/tobikodata/http_client/api_models/v1/common.py +0 -0
  17. {tobiko_cloud_api_client-202508.58.0 → tobiko_cloud_api_client-202508.60.0}/tobikodata/http_client/api_models/v1/dags.py +0 -0
  18. {tobiko_cloud_api_client-202508.58.0 → tobiko_cloud_api_client-202508.60.0}/tobikodata/http_client/api_models/v1/evaluations.py +0 -0
  19. {tobiko_cloud_api_client-202508.58.0 → tobiko_cloud_api_client-202508.60.0}/tobikodata/http_client/api_models/v1/runs.py +0 -0
  20. {tobiko_cloud_api_client-202508.58.0 → tobiko_cloud_api_client-202508.60.0}/tobikodata/http_client/public.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tobiko-cloud-api-client
3
- Version: 202508.58.0
3
+ Version: 202508.60.0
4
4
  Author: TobikoData Inc.
5
5
  Author-email: engineering@tobikodata.com
6
6
  Requires-Python: <3.13,>=3.9
@@ -10,4 +10,4 @@ Requires-Dist: pydantic>=2.0.0
10
10
  Requires-Dist: rich[jupyter]
11
11
  Requires-Dist: ruamel.yaml
12
12
  Requires-Dist: tenacity
13
- Requires-Dist: tobiko-cloud-helpers==202508.58.0
13
+ Requires-Dist: tobiko-cloud-helpers==202508.60.0
@@ -14,7 +14,7 @@ setup(**{
14
14
  'rich[jupyter]',
15
15
  'ruamel.yaml',
16
16
  'tenacity',
17
- 'tobiko-cloud-helpers==202508.58.0',
17
+ 'tobiko-cloud-helpers==202508.60.0',
18
18
  ),
19
19
  'name': 'tobiko-cloud-api-client',
20
20
  'namespace_packages': (
@@ -27,5 +27,5 @@ setup(**{
27
27
  'tobikodata.http_client.api_models.v1',
28
28
  ),
29
29
  'python_requires': '<3.13,>=3.9',
30
- 'version': '202508.58.0',
30
+ 'version': '202508.60.0',
31
31
  })
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tobiko-cloud-api-client
3
- Version: 202508.58.0
3
+ Version: 202508.60.0
4
4
  Author: TobikoData Inc.
5
5
  Author-email: engineering@tobikodata.com
6
6
  Requires-Python: <3.13,>=3.9
@@ -10,4 +10,4 @@ Requires-Dist: pydantic>=2.0.0
10
10
  Requires-Dist: rich[jupyter]
11
11
  Requires-Dist: ruamel.yaml
12
12
  Requires-Dist: tenacity
13
- Requires-Dist: tobiko-cloud-helpers==202508.58.0
13
+ Requires-Dist: tobiko-cloud-helpers==202508.60.0
@@ -4,4 +4,4 @@ pydantic>=2.0.0
4
4
  rich[jupyter]
5
5
  ruamel.yaml
6
6
  tenacity
7
- tobiko-cloud-helpers==202508.58.0
7
+ tobiko-cloud-helpers==202508.60.0
@@ -25,14 +25,20 @@ yaml = YAML()
25
25
 
26
26
  # This is duplicated from tcloud in order to avoid pulling in tcloud deps into
27
27
  # http client
28
+ SCOPE = os.environ.get("TCLOUD_SCOPE", "tbk:scope:projects")
29
+ """The scopes to request from the tobiko auth service"""
30
+
28
31
  TCLOUD_PATH = Path(os.environ.get("TCLOUD_HOME", Path.home() / ".tcloud"))
29
32
  """The location of the tcloud config folder"""
30
33
 
31
- CLIENT_ID = "f695a000-bc5b-43c2-bcb7-8e0179ddff0c"
32
- """The oauth client ID to use"""
34
+ CLIENT_ID = os.environ.get("TCLOUD_CLIENT_ID", "f695a000-bc5b-43c2-bcb7-8e0179ddff0c")
35
+ """The OAuth client ID to use"""
36
+
37
+ CLIENT_SECRET = os.environ.get("TCLOUD_CLIENT_SECRET")
38
+ """The OAuth client secret to use for the client credentials (service-to-service) flow"""
33
39
 
34
- TOKEN_URL = "https://cloud.tobikodata.com/auth/token"
35
- """The oauth token endpoint to use"""
40
+ TOKEN_URL = os.environ.get("TCLOUD_TOKEN_URL", "https://cloud.tobikodata.com/auth/token")
41
+ """The OAuth token endpoint to use"""
36
42
 
37
43
  THEME = Theme(
38
44
  {
@@ -100,7 +106,7 @@ class SSOAuth:
100
106
 
101
107
  def __init__(self) -> None:
102
108
  self.console = Console(theme=THEME)
103
- self.session = OAuth2Session(CLIENT_ID)
109
+ self.session = OAuth2Session(CLIENT_ID, CLIENT_SECRET, scope=SCOPE)
104
110
  self.tokenInfo = SSOAuth._load_auth_yaml()
105
111
 
106
112
  def id_token(self) -> t.Optional[str]:
@@ -131,9 +137,24 @@ class SSOAuth:
131
137
  # We failed to refresh, logout
132
138
  SSOAuth._delete_auth_yaml()
133
139
 
140
+ # Can we use client credentials?
141
+ if CLIENT_SECRET:
142
+ return self.login_with_client_credentials()
143
+
134
144
  return None
135
145
 
146
+ def login_with_client_credentials(self) -> t.Optional[str]:
147
+ self.session.fetch_token(
148
+ TOKEN_URL,
149
+ grant_type="client_credentials",
150
+ )
151
+ return self._create_token_info(self.session.token)["id_token"]
152
+
136
153
  def refresh_token(self) -> t.Optional[str]:
154
+ # Can we use client credentials?
155
+ if CLIENT_SECRET:
156
+ return self.login_with_client_credentials()
157
+
137
158
  if not self.tokenInfo:
138
159
  self.console.print("Not currently authenticated", style="error")
139
160
  return None
@@ -159,10 +180,12 @@ class SSOAuth:
159
180
  "token_type": token["token_type"],
160
181
  "expires_at": token["expires_at"],
161
182
  "access_token": token["access_token"],
162
- "refresh_token": token["refresh_token"],
163
183
  "id_token": token["id_token"],
164
184
  }
165
185
 
186
+ if "refresh_token" in token:
187
+ self.tokenInfo["refresh_token"] = token["refresh_token"]
188
+
166
189
  SSOAuth._save_auth_yaml(self.tokenInfo)
167
190
 
168
191
  return self.tokenInfo