beamlit 0.0.29rc30__py3-none-any.whl → 0.0.29rc31__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- beamlit/authentication/authentication.py +11 -14
- beamlit/client.py +14 -13
- {beamlit-0.0.29rc30.dist-info → beamlit-0.0.29rc31.dist-info}/METADATA +1 -1
- {beamlit-0.0.29rc30.dist-info → beamlit-0.0.29rc31.dist-info}/RECORD +5 -5
- {beamlit-0.0.29rc30.dist-info → beamlit-0.0.29rc31.dist-info}/WHEEL +0 -0
@@ -1,20 +1,15 @@
|
|
1
|
+
import os
|
1
2
|
from dataclasses import dataclass
|
2
3
|
from typing import Dict, Generator
|
3
|
-
import os
|
4
|
-
|
5
|
-
from httpx import Auth, Request, Response
|
6
4
|
|
7
5
|
from beamlit.common.settings import Settings, get_settings
|
6
|
+
from httpx import Auth, Request, Response
|
8
7
|
|
9
8
|
from ..client import AuthenticatedClient
|
10
9
|
from .apikey import ApiKeyProvider
|
11
10
|
from .clientcredentials import ClientCredentials
|
12
|
-
from .credentials import (
|
13
|
-
|
14
|
-
current_context,
|
15
|
-
load_credentials,
|
16
|
-
load_credentials_from_settings,
|
17
|
-
)
|
11
|
+
from .credentials import (Credentials, current_context, load_credentials,
|
12
|
+
load_credentials_from_settings)
|
18
13
|
from .device_mode import BearerToken
|
19
14
|
|
20
15
|
|
@@ -27,13 +22,15 @@ class PublicProvider(Auth):
|
|
27
22
|
class RunClientWithCredentials:
|
28
23
|
credentials: Credentials
|
29
24
|
workspace: str
|
30
|
-
api_url: str = "
|
31
|
-
run_url: str = "
|
25
|
+
api_url: str = ""
|
26
|
+
run_url: str = ""
|
32
27
|
|
33
28
|
def __post_init__(self):
|
34
|
-
|
35
|
-
|
36
|
-
|
29
|
+
from ..common.settings import get_settings
|
30
|
+
|
31
|
+
settings = get_settings()
|
32
|
+
self.api_url = settings.base_url
|
33
|
+
self.run_url = settings.run_url
|
37
34
|
|
38
35
|
|
39
36
|
def new_client_from_settings(settings: Settings):
|
beamlit/client.py
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
import os
|
2
1
|
import ssl
|
3
2
|
from typing import Any, Optional, Union
|
4
3
|
|
@@ -38,13 +37,8 @@ class Client:
|
|
38
37
|
|
39
38
|
"""
|
40
39
|
|
41
|
-
# Determine the base URL based on the environment
|
42
|
-
default_base_url = "https://api.beamlit.com/v0"
|
43
|
-
if os.getenv("BL_ENV") == "dev":
|
44
|
-
default_base_url = "https://api.beamlit.dev/v0"
|
45
|
-
|
46
40
|
raise_on_unexpected_status: bool = field(default=True, kw_only=True)
|
47
|
-
_base_url: str = field(alias="base_url", default=
|
41
|
+
_base_url: str = field(alias="base_url", default="")
|
48
42
|
_cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
|
49
43
|
_headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
|
50
44
|
_provider: httpx.Auth = field(default=None, alias="provider")
|
@@ -55,6 +49,12 @@ class Client:
|
|
55
49
|
_client: Optional[httpx.Client] = field(default=None, init=False)
|
56
50
|
_async_client: Optional[httpx.AsyncClient] = field(default=None, init=False)
|
57
51
|
|
52
|
+
def __post_init__(self):
|
53
|
+
from .common.settings import get_settings
|
54
|
+
|
55
|
+
settings = get_settings()
|
56
|
+
self._base_url = settings.base_url
|
57
|
+
|
58
58
|
def with_headers(self, headers: dict[str, str]) -> "Client":
|
59
59
|
"""Get a new client matching this one with additional headers"""
|
60
60
|
if self._client is not None:
|
@@ -175,13 +175,8 @@ class AuthenticatedClient:
|
|
175
175
|
provider: AuthProvider to use for authentication
|
176
176
|
"""
|
177
177
|
|
178
|
-
# Determine the base URL based on the environment
|
179
|
-
default_base_url = "https://api.beamlit.com/v0"
|
180
|
-
if os.getenv("BL_ENV") == "dev":
|
181
|
-
default_base_url = "https://api.beamlit.dev/v0"
|
182
|
-
|
183
178
|
raise_on_unexpected_status: bool = field(default=True, kw_only=True)
|
184
|
-
_base_url: str = field(alias="base_url", default=
|
179
|
+
_base_url: str = field(alias="base_url", default="")
|
185
180
|
_cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
|
186
181
|
_headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
|
187
182
|
_provider: httpx.Auth = field(default=None, alias="provider")
|
@@ -192,6 +187,12 @@ class AuthenticatedClient:
|
|
192
187
|
_client: Optional[httpx.Client] = field(default=None, init=False)
|
193
188
|
_async_client: Optional[httpx.AsyncClient] = field(default=None, init=False)
|
194
189
|
|
190
|
+
def __post_init__(self):
|
191
|
+
from .common.settings import get_settings
|
192
|
+
|
193
|
+
settings = get_settings()
|
194
|
+
self._base_url = settings.base_url
|
195
|
+
|
195
196
|
def with_headers(self, headers: dict[str, str]) -> "AuthenticatedClient":
|
196
197
|
"""Get a new client matching this one with additional headers"""
|
197
198
|
if self._client is not None:
|
@@ -1,5 +1,5 @@
|
|
1
1
|
beamlit/__init__.py,sha256=545gFC-wLLwUktWcOAjUWe_Glha40tBetRTOYSfHnbI,164
|
2
|
-
beamlit/client.py,sha256=
|
2
|
+
beamlit/client.py,sha256=PnR6ybZk5dLIJPnDKAf2epHOeQC_7yL0fG4muvphHjA,12695
|
3
3
|
beamlit/errors.py,sha256=gO8GBmKqmSNgAg-E5oT-oOyxztvp7V_6XG7OUTT15q0,546
|
4
4
|
beamlit/py.typed,sha256=8ZJUsxZiuOy1oJeVhsTWQhTG_6pTVHVXk5hJL79ebTk,25
|
5
5
|
beamlit/run.py,sha256=RLwMv5f_S8lw7Wq7O6DvEcOl0nGYh769qjGl_SmR9Z0,1338
|
@@ -124,7 +124,7 @@ beamlit/api/workspaces/update_workspace.py,sha256=qa5DV2UJSUYuB_ibALb4E9ghKpT1Ha
|
|
124
124
|
beamlit/api/workspaces/update_workspace_user_role.py,sha256=Yn9iuJ4tKtauzBiJyU4-wYUMS9g98X2Om8zs7UkzrY8,4917
|
125
125
|
beamlit/authentication/__init__.py,sha256=wiXqRbc7E-ulrH_ueA9duOGFvXeo7-RvhSD1XbFogMo,1020
|
126
126
|
beamlit/authentication/apikey.py,sha256=KNBTgdi0VBzBAAmSwU2X1QoB58vRbg8wkXb8-GTZCQo,657
|
127
|
-
beamlit/authentication/authentication.py,sha256=
|
127
|
+
beamlit/authentication/authentication.py,sha256=8R-3WdQSykNjCbebAW2p8Glvw5nlAmSEZr6Ylo-vPuc,3377
|
128
128
|
beamlit/authentication/clientcredentials.py,sha256=cxZPPu--CgizwqX0pdfFQ91gJt1EFKwyy-aBB_dXX7I,3990
|
129
129
|
beamlit/authentication/credentials.py,sha256=p_1xenabCbQuRz7BiFk7oTK4uCxAt_zoyku5o-jcKGE,5343
|
130
130
|
beamlit/authentication/device_mode.py,sha256=tmr22gllKOZwBRub_QjF5pYa425x-nE8tQNpZ_EGR6g,3644
|
@@ -254,6 +254,6 @@ beamlit/serve/app.py,sha256=OpwPjRdyHZK6J-ziPwhiRDGGa2mvCrFVcBFE6alJVOM,3071
|
|
254
254
|
beamlit/serve/middlewares/__init__.py,sha256=1dVmnOmhAQWvWktqHkKSIX-YoF6fmMU8xkUQuhg_rJU,148
|
255
255
|
beamlit/serve/middlewares/accesslog.py,sha256=Mu4T4_9OvHybjA0ApzZFpgi2C8f3X1NbUk-76v634XM,631
|
256
256
|
beamlit/serve/middlewares/processtime.py,sha256=lDAaIasZ4bwvN-HKHvZpaD9r-yrkVNZYx4abvbjbrCg,411
|
257
|
-
beamlit-0.0.
|
258
|
-
beamlit-0.0.
|
259
|
-
beamlit-0.0.
|
257
|
+
beamlit-0.0.29rc31.dist-info/METADATA,sha256=wtvS37H-4XfjTewjRWIlNgalDC5yy_C4nEsQEdE5Lfc,2405
|
258
|
+
beamlit-0.0.29rc31.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
259
|
+
beamlit-0.0.29rc31.dist-info/RECORD,,
|
File without changes
|