removed workspace_name from clockify api init

This commit is contained in:
iLLiCiTiT 2020-07-22 18:32:45 +02:00
parent eb4153a786
commit ec9ff17337
2 changed files with 8 additions and 9 deletions

View file

@ -7,10 +7,10 @@ from . import CLOCKIFY_ENDPOINT, ADMIN_PERMISSION_NAMES, CREDENTIALS_JSON_PATH
class ClockifyAPI:
def __init__(self, workspace_name=None, api_key=None, master_parent=None):
self.workspace_name = workspace_name
self.master_parent = master_parent
def __init__(self, api_key=None, master_parent=None):
self.workspace_name = None
self.workspace_id = None
self.master_parent = master_parent
self.api_key = api_key
@property
@ -73,7 +73,7 @@ class ClockifyAPI:
)
# this regex is neccessary: UNICODE strings are crashing
# during json serialization
id_regex ='\"{1}id\"{1}\:{1}\"{1}\w+\"{1}'
id_regex = '\"{1}id\"{1}\:{1}\"{1}\w+\"{1}'
result = re.findall(id_regex, str(response.content))
if len(result) != 1:
# replace with log and better message?

View file

@ -16,11 +16,10 @@ class SyncClocifyServer(BaseAction):
def __init__(self, *args, **kwargs):
super(SyncClocifyServer, self).__init__(*args, **kwargs)
self.workspace_name = os.environ.get("CLOCKIFY_WORKSPACE")
workspace_name = os.environ.get("CLOCKIFY_WORKSPACE")
api_key = os.environ.get("CLOCKIFY_API_KEY")
self.clockapi = ClockifyAPI(self.workspace_name, api_key)
self.api_key = api_key
self.clockapi = ClockifyAPI(api_key)
self.clockapi.set_workspace(workspace_name)
if api_key is None:
modified_key = "None"
else:
@ -36,7 +35,7 @@ class SyncClocifyServer(BaseAction):
self.log.info(
"Clockify info. Workspace: \"{}\" API key: \"{}\"".format(
str(self.workspace_name), str(modified_key)
str(workspace_name), str(modified_key)
)
)