diff --git a/solvebio/__init__.py b/solvebio/__init__.py index 48120c78..8f5cd14b 100644 --- a/solvebio/__init__.py +++ b/solvebio/__init__.py @@ -84,6 +84,19 @@ def emit(self, record): _init_logging() + +""" +This is a cached value of client._host, and is kept in for backwards compatibility +Use this with caution, as you should prefer relying on get_api_host() instead +""" +api_host = None + + +def _set_cached_api_host(host): + global api_host + api_host = host + + from .version import VERSION # noqa from .errors import SolveError from .query import Query, BatchQuery, Filter, GenomicFilter @@ -178,9 +191,15 @@ def whoami(): def get_api_host(): + global api_host + api_host = client._host + return client._host +get_api_host() + + __all__ = [ 'Annotator', 'Application', diff --git a/solvebio/auth.py b/solvebio/auth.py index 5c054574..ac39e284 100644 --- a/solvebio/auth.py +++ b/solvebio/auth.py @@ -158,7 +158,8 @@ def authenticate( # TODO: warn user if WWW url is provided in edp_login! - # @TODO: remove references to solvebio.api_host, etc... + from solvebio import _set_cached_api_host + _set_cached_api_host(host) return host, auth