Skip to content

Commit 295b4e7

Browse files
Johannes HötterJohannes Hötter
authored andcommitted
switch between stages
1 parent a6fedf7 commit 295b4e7

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

onetask/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010

1111
class Client:
1212
def __init__(
13-
self, user_name: str, password: str, project_id: str, debug: bool = False
13+
self, user_name: str, password: str, project_id: str, stage: str = "prod"
1414
):
15-
if not debug:
15+
settings.set_stage(stage)
16+
if stage in ["prod", "test", "dev"]:
1617
self.session_token = api_calls.create_session_token(
1718
user_name=user_name, password=password
1819
)

onetask/settings.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
# -*- coding: utf-8 -*-
2-
LOCALHOST_SWITCH = False
2+
STAGE: str
33

44

5-
def set_to_localhost():
6-
global LOCALHOST_SWITCH
7-
LOCALHOST_SWITCH = True
5+
def set_stage(stage):
6+
global STAGE
7+
STAGE = stage
88

99

1010
def get_base_url():
11-
return "http://localhost:8000" if LOCALHOST_SWITCH else "https://app.dev.onetask.ai"
11+
global STAGE
12+
if STAGE == "prod":
13+
return "https://app.onetask.ai"
14+
elif STAGE == "test":
15+
return "https://app.test.onetask.ai"
16+
elif STAGE == "dev":
17+
return "https://app.dev.onetask.ai"
18+
else:
19+
return "http://localhost:8000"
1220

1321

1422
def get_authentication_url():

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
setup(
1212
name="onetask",
13-
version="0.1.0",
13+
version="0.1.1",
1414
author="onetask",
1515
author_email="[email protected]",
1616
description="Official Python SDK for the onetask API",

0 commit comments

Comments
 (0)