diff --git a/.github/.DS_Store b/.github/.DS_Store index d31b785..adb0571 100644 Binary files a/.github/.DS_Store and b/.github/.DS_Store differ diff --git a/.gitignore b/.gitignore index f8ffc75..e7d8a0f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ # Byte-compiled / optimized / DLL files __pycache__/ +SCRAT*/ +scra*.py *.py[cod] diff --git a/evdspy/EVDSlocal/config/apikey_class.py b/evdspy/EVDSlocal/config/apikey_class.py index 8b837b7..68cb591 100644 --- a/evdspy/EVDSlocal/config/apikey_class.py +++ b/evdspy/EVDSlocal/config/apikey_class.py @@ -28,7 +28,9 @@ class ApiKeyDict: def __init__(self): self.runtime_apikey = ApiKeyValue("runtime", False, ApiKeyType.runtime) self.from_file_apikey = ApiKeyValue("fromfile", False, ApiKeyType.from_file) - self.from_file_options_api_key = ApiKeyValue("fromfile_options", False, ApiKeyType.from_file_options) + self.from_file_options_api_key = ApiKeyValue( + "fromfile_options", False, ApiKeyType.from_file_options + ) def set_value(self, type_: Union[str, ApiKeyType], value): if type_ in ["runtime", ApiKeyType.runtime]: @@ -45,7 +47,7 @@ def set_value(self, type_: Union[str, ApiKeyType], value): class ApikeyClass(object): def __new__(cls): - if not hasattr(cls, 'instance'): + if not hasattr(cls, "instance"): cls.instance = super(ApikeyClass, cls).__new__(cls) cls.post_init(cls) return cls.instance @@ -105,6 +107,7 @@ def key(self): @staticmethod def obscure(key=None): from evdspy.EVDSlocal.utils.utils_general import encode + if key is None: key = ApikeyClass().key if not isinstance(key, str): @@ -131,7 +134,21 @@ def set_api(cls, key: str): raise "set api not implemented" def get_api_keys(cls): + def get_env(): + import os + + try: + from dotenv import load_dotenv + + load_dotenv() + except: + pass + api_key_env = os.getenv("EVDS_API_KEY") + api_key_env = api_key_env if len(str(api_key_env)) > 5 else False + return ApiKeyValue("dotenv", api_key_env) + keys = [ + get_env(), cls.instance.APIKEYDict.runtime_apikey, cls.instance.APIKEYDict.from_file_apikey, cls.instance.APIKEYDict.from_file_options_api_key, diff --git a/evdspy/EVDSlocal/index_requests/categories.py b/evdspy/EVDSlocal/index_requests/categories.py index 0ea5891..440f0bd 100644 --- a/evdspy/EVDSlocal/index_requests/categories.py +++ b/evdspy/EVDSlocal/index_requests/categories.py @@ -14,9 +14,9 @@ def get_categories_data() -> str: def get_table_header(): from rich.table import Table table = Table(title="Categories / Kategoriler") - table.add_column("ID/Sayı", justify="right", style="cyan", no_wrap=True) - table.add_column("Title/BaÅŸlık (ENG)", style="magenta") - table.add_column("Title/BaÅŸlık (TR)", justify="right", style="green") + table.add_column("ID/Sayi", justify="right", style="cyan", no_wrap=True) + table.add_column("Title/Baslik (ENG)", style="magenta") + table.add_column("Title/Baslik (TR)", justify="right", style="green") return table from typing import List import typing as t diff --git a/pyproject.toml b/pyproject.toml index 803c63e..298208e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ [tool.poetry] name = "evdspy" -version = "1.1.29" +version = "1.1.30" description = "A versatile interface for the 'EDDS' (EVDS) API of the Central Bank of the Republic of Türkiye (https://evds2.tcmb.gov.tr/index.php?/evds/userDocs). This package allows users to easily access and manage economic data through a user-friendly menu function. It features a robust caching mechanism to enhance the efficiency of data requests by storing frequently accessed data for selected periods. Required API keys can be obtained by registering on the EVDS website." authors = ["Sermet Pekin "] license = "MIT" @@ -31,6 +31,7 @@ openpyxl = ">3.0.10" rich = ">=12.5.1" requests = ">=2.28.1" pytest = ">=7.0.0" +python-dotenv=">=1.0.0" [tool.poetry.dev-dependencies] pygments = ">=2.6.0" commonmark = ">=0.9.0" diff --git a/requirements-dev.txt b/requirements-dev.txt index 870aaf7..d841a71 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -16,3 +16,4 @@ pytest>=8.1.0 ruff>=0.5.1 tox black>=24.3.0 +python-dotenv>=1.0.0 \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 26ac58e..df80a63 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,3 +15,4 @@ openpyxl>=3.0.10 numpy>=1.5.0 pytest>=8.1.0 black>=24.3.0 +python-dotenv>=1.0.0 \ No newline at end of file