From bae32bf42565acd7749c235eab37ae4598d43925 Mon Sep 17 00:00:00 2001 From: David Moreau Simard Date: Wed, 5 Jun 2019 09:36:41 -0400 Subject: [PATCH] Only import the offline client if necessary in get_client Otherwise, importing ara.client.utils triggers an import to the offline client which requires django dependencies to be installed. Change-Id: I61e659cfbeec3aa696f17db3addfbaa33af2e860 --- ara/clients/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ara/clients/utils.py b/ara/clients/utils.py index 735f6156..a4e4bad0 100644 --- a/ara/clients/utils.py +++ b/ara/clients/utils.py @@ -18,7 +18,6 @@ from requests.auth import HTTPBasicAuth from ara.clients.http import AraHttpClient -from ara.clients.offline import AraOfflineClient def get_client(client="offline", endpoint="http://127.0.0.1:8000", timeout=30, username=None, password=None): @@ -30,6 +29,8 @@ def get_client(client="offline", endpoint="http://127.0.0.1:8000", timeout=30, u auth = HTTPBasicAuth(username, password) if client == "offline": + from ara.clients.offline import AraOfflineClient + return AraOfflineClient(auth=auth) elif client == "http": return AraHttpClient(endpoint=endpoint, timeout=timeout, auth=auth)