sweatstack 0.19.1__tar.gz → 0.20.0__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.
- {sweatstack-0.19.1 → sweatstack-0.20.0}/PKG-INFO +1 -1
- {sweatstack-0.19.1 → sweatstack-0.20.0}/pyproject.toml +1 -1
- {sweatstack-0.19.1 → sweatstack-0.20.0}/src/sweatstack/client.py +15 -8
- {sweatstack-0.19.1 → sweatstack-0.20.0}/uv.lock +1 -1
- {sweatstack-0.19.1 → sweatstack-0.20.0}/.gitignore +0 -0
- {sweatstack-0.19.1 → sweatstack-0.20.0}/.python-version +0 -0
- {sweatstack-0.19.1 → sweatstack-0.20.0}/DEVELOPMENT.md +0 -0
- {sweatstack-0.19.1 → sweatstack-0.20.0}/Makefile +0 -0
- {sweatstack-0.19.1 → sweatstack-0.20.0}/README.md +0 -0
- {sweatstack-0.19.1 → sweatstack-0.20.0}/playground/.ipynb_checkpoints/Untitled-checkpoint.ipynb +0 -0
- {sweatstack-0.19.1 → sweatstack-0.20.0}/playground/README.md +0 -0
- {sweatstack-0.19.1 → sweatstack-0.20.0}/playground/Sweat Stack examples/Getting started.ipynb +0 -0
- {sweatstack-0.19.1 → sweatstack-0.20.0}/playground/Untitled.ipynb +0 -0
- {sweatstack-0.19.1 → sweatstack-0.20.0}/playground/hello.py +0 -0
- {sweatstack-0.19.1 → sweatstack-0.20.0}/playground/pyproject.toml +0 -0
- {sweatstack-0.19.1 → sweatstack-0.20.0}/src/sweatstack/Sweat Stack examples/Getting started.ipynb +0 -0
- {sweatstack-0.19.1 → sweatstack-0.20.0}/src/sweatstack/__init__.py +0 -0
- {sweatstack-0.19.1 → sweatstack-0.20.0}/src/sweatstack/cli.py +0 -0
- {sweatstack-0.19.1 → sweatstack-0.20.0}/src/sweatstack/constants.py +0 -0
- {sweatstack-0.19.1 → sweatstack-0.20.0}/src/sweatstack/ipython_init.py +0 -0
- {sweatstack-0.19.1 → sweatstack-0.20.0}/src/sweatstack/jupyterlab_oauth2_startup.py +0 -0
- {sweatstack-0.19.1 → sweatstack-0.20.0}/src/sweatstack/openapi_schemas.py +0 -0
- {sweatstack-0.19.1 → sweatstack-0.20.0}/src/sweatstack/py.typed +0 -0
- {sweatstack-0.19.1 → sweatstack-0.20.0}/src/sweatstack/schemas.py +0 -0
- {sweatstack-0.19.1 → sweatstack-0.20.0}/src/sweatstack/streamlit.py +0 -0
- {sweatstack-0.19.1 → sweatstack-0.20.0}/src/sweatstack/sweatshell.py +0 -0
- {sweatstack-0.19.1 → sweatstack-0.20.0}/src/sweatstack/utils.py +0 -0
|
@@ -107,7 +107,14 @@ class OAuth2Mixin:
|
|
|
107
107
|
|
|
108
108
|
|
|
109
109
|
class DelegationMixin:
|
|
110
|
-
def
|
|
110
|
+
def _validate_user(self, user: str | UserSummary):
|
|
111
|
+
if isinstance(user, UserSummary):
|
|
112
|
+
return user.id
|
|
113
|
+
else:
|
|
114
|
+
return user
|
|
115
|
+
|
|
116
|
+
def _get_delegated_token(self, user: str | UserSummary):
|
|
117
|
+
user_id = self._validate_user(user)
|
|
111
118
|
with self._http_client() as client:
|
|
112
119
|
response = client.post(
|
|
113
120
|
"/api/v1/oauth/delegated-token",
|
|
@@ -117,8 +124,8 @@ class DelegationMixin:
|
|
|
117
124
|
|
|
118
125
|
return response.json()
|
|
119
126
|
|
|
120
|
-
def switch_user(self,
|
|
121
|
-
token_response = self._get_delegated_token(
|
|
127
|
+
def switch_user(self, user: str | UserSummary):
|
|
128
|
+
token_response = self._get_delegated_token(user)
|
|
122
129
|
self.api_key = token_response["access_token"]
|
|
123
130
|
self.refresh_token = token_response["refresh_token"]
|
|
124
131
|
|
|
@@ -135,8 +142,8 @@ class DelegationMixin:
|
|
|
135
142
|
self.api_key = token_response["access_token"]
|
|
136
143
|
self.refresh_token = token_response["refresh_token"]
|
|
137
144
|
|
|
138
|
-
def delegated_client(self,
|
|
139
|
-
token_response = self._get_delegated_token(
|
|
145
|
+
def delegated_client(self, user: str | UserSummary):
|
|
146
|
+
token_response = self._get_delegated_token(user)
|
|
140
147
|
return self.__class__(
|
|
141
148
|
api_key=token_response["access_token"],
|
|
142
149
|
refresh_token=token_response["refresh_token"],
|
|
@@ -154,7 +161,7 @@ class DelegationMixin:
|
|
|
154
161
|
)
|
|
155
162
|
|
|
156
163
|
|
|
157
|
-
class Client(OAuth2Mixin, DelegationMixin
|
|
164
|
+
class Client(OAuth2Mixin, DelegationMixin):
|
|
158
165
|
def __init__(
|
|
159
166
|
self,
|
|
160
167
|
api_key: str | None = None,
|
|
@@ -604,7 +611,7 @@ class Client(OAuth2Mixin, DelegationMixin, JupyterInteractivityMixin):
|
|
|
604
611
|
response.raise_for_status()
|
|
605
612
|
return response.json()
|
|
606
613
|
|
|
607
|
-
def
|
|
614
|
+
def get_users(self) -> list[UserSummary]:
|
|
608
615
|
with self._http_client() as client:
|
|
609
616
|
response = client.get(
|
|
610
617
|
url="/api/v1/users/",
|
|
@@ -651,7 +658,7 @@ _generate_singleton_methods(
|
|
|
651
658
|
[
|
|
652
659
|
"login",
|
|
653
660
|
|
|
654
|
-
"
|
|
661
|
+
"get_users",
|
|
655
662
|
|
|
656
663
|
"get_activities",
|
|
657
664
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sweatstack-0.19.1 → sweatstack-0.20.0}/playground/.ipynb_checkpoints/Untitled-checkpoint.ipynb
RENAMED
|
File without changes
|
|
File without changes
|
{sweatstack-0.19.1 → sweatstack-0.20.0}/playground/Sweat Stack examples/Getting started.ipynb
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sweatstack-0.19.1 → sweatstack-0.20.0}/src/sweatstack/Sweat Stack examples/Getting started.ipynb
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|