Мелкие правки

This commit is contained in:
2025-05-26 13:08:21 +03:00
parent 47e93333e4
commit 405576d8cc
3 changed files with 6 additions and 8 deletions

View File

@@ -67,7 +67,6 @@ class ClockifyAPI(ClockifyConfig):
def get_tags(self, **kwargs) -> list[Tag]:
"""
workspace_id: str - required
name: str - optional
archived: bool - optional
"""
@@ -126,14 +125,13 @@ class ClockifyAPI(ClockifyConfig):
def getenvs(self):
resp = requests.get(self.base_url + self.user_url, headers={"X-API-KEY": self.token})
filename = ".env.txt"
if not resp.ok:
logger.error(resp.json())
raise requests.exceptions.RequestException(Fore.RED + "Ошибка запроса.")
with open(filename, "w") as file:
raise requests.exceptions.RequestException(Fore.RED + "Ошибка запроса." + Fore.RESET)
with open(config.ENV_TXT, "w") as file:
try:
file.write(f"USER_ID={resp.json()['id']}\nWORKSPACE_ID={resp.json()['activeWorkspace']}")
logger.info(f"{Fore.GREEN}Необходимые переменные были сохранены в файл {filename}{Fore.RESET}")
logger.info(f"{Fore.GREEN}Необходимые переменные были сохранены в файл {config.ENV_TXT}{Fore.RESET}")
except Exception as e:
logger.error(f"{Fore.RED}Не удалось сохранить необходимые переменные.{Fore.RESET}")
raise e
raise e