Skip to content

Commit a2fa77c

Browse files
obofortyRajmund Csombordi
andauthored
Added api_host to the module (#490)
Co-authored-by: Rajmund Csombordi <rajmund.csombordi@precisionformedicine.com>
1 parent aa0d16b commit a2fa77c

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

solvebio/__init__.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,19 @@ def emit(self, record):
8484

8585
_init_logging()
8686

87+
88+
"""
89+
This is a cached value of client._host, and is kept in for backwards compatibility
90+
Use this with caution, as you should prefer relying on get_api_host() instead
91+
"""
92+
api_host = None
93+
94+
95+
def _set_cached_api_host(host):
96+
global api_host
97+
api_host = host
98+
99+
87100
from .version import VERSION # noqa
88101
from .errors import SolveError
89102
from .query import Query, BatchQuery, Filter, GenomicFilter
@@ -178,9 +191,15 @@ def whoami():
178191

179192

180193
def get_api_host():
194+
global api_host
195+
api_host = client._host
196+
181197
return client._host
182198

183199

200+
get_api_host()
201+
202+
184203
__all__ = [
185204
'Annotator',
186205
'Application',

solvebio/auth.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ def authenticate(
158158

159159
# TODO: warn user if WWW url is provided in edp_login!
160160

161-
# @TODO: remove references to solvebio.api_host, etc...
161+
from solvebio import _set_cached_api_host
162+
_set_cached_api_host(host)
162163

163164
return host, auth
164165

0 commit comments

Comments
 (0)