From a72b1e1f8ca4b6fc9838759c4a07c7ef5bd2576d Mon Sep 17 00:00:00 2001 From: Denis Rouzaud Date: Thu, 16 Feb 2023 15:17:11 +0100 Subject: [PATCH] API compatibility constructor --- pytransifex/api.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pytransifex/api.py b/pytransifex/api.py index 510d9fd..6195f8c 100644 --- a/pytransifex/api.py +++ b/pytransifex/api.py @@ -335,6 +335,12 @@ class Transifex: client = None + def __new__(cls, api_token: str, organization: str, i18n_type: str = 'PO', defer_login: bool = False): + if not cls.client: + cfg = ApiConfig(api_token, organization, i18n_type) + cls.client = Client(cfg, defer_login) + return client + def __new__(cls, defer_login: bool = False): if not cls.client: cls.client = Client(ApiConfig.from_env(), defer_login)