diff --git a/.env-example b/.env-example new file mode 100644 index 0000000..4ac4a22 --- /dev/null +++ b/.env-example @@ -0,0 +1,4 @@ +URL="https://camisatoshi.com" +CONSUMER_KEY= +CONSUMER_SECRET= +VERSION="wc/v3" \ No newline at end of file diff --git a/camisatoshi_wordpress_reports/controllers.py b/camisatoshi_wordpress_reports/controllers.py index 1b97ec2..347698d 100644 --- a/camisatoshi_wordpress_reports/controllers.py +++ b/camisatoshi_wordpress_reports/controllers.py @@ -1,4 +1,15 @@ +from pathlib import Path + +from dotenv import dotenv_values +from woocommerce import API + +API_CONFIG = dotenv_values( + dotenv_path=Path.home() / Path(".camisatoshi-wordpress-reports/.env") +) def check_health(url: str): + print( f"Ehem... Yeah... so... I've definitely checked {url}... I just don't remember clearly if it was alive or what..." - ) \ No newline at end of file + ) + print(Path("~/.camisatoshi-wordpress-reports/.env")) + print(f"By the way, I found this: {API_CONFIG}") diff --git a/poetry.lock b/poetry.lock index 5e56922..8280a80 100644 --- a/poetry.lock +++ b/poetry.lock @@ -180,6 +180,20 @@ files = [ [package.extras] plugins = ["importlib-metadata"] +[[package]] +name = "python-dotenv" +version = "1.0.0" +description = "Read key-value pairs from a .env file and set them as environment variables" +optional = false +python-versions = ">=3.8" +files = [ + {file = "python-dotenv-1.0.0.tar.gz", hash = "sha256:a8df96034aae6d2d50a4ebe8216326c61c3eb64836776504fcca410e5937a3ba"}, + {file = "python_dotenv-1.0.0-py3-none-any.whl", hash = "sha256:f5971a9226b701070a4bf2c38c89e5a3f0d64de8debda981d1db98583009122a"}, +] + +[package.extras] +cli = ["click (>=5.0)"] + [[package]] name = "requests" version = "2.31.0" @@ -299,4 +313,4 @@ requests = "*" [metadata] lock-version = "2.0" python-versions = "^3.9" -content-hash = "0f8df4840c70ba46322e889c77e4b666992ff139a1062b02bbc8e1cbeb08170c" +content-hash = "16cb9a31aa761e5db7078878202ae58dfed0eac3ade16c08698e2c94855ca74c" diff --git a/pyproject.toml b/pyproject.toml index 458782b..3da036c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,6 +13,7 @@ camisatoshi-wordpress-reports = "camisatoshi_wordpress_reports.cli:app" python = "^3.9" typer = {extras = ["all"], version = "^0.9.0"} woocommerce = "^3.0.0" +python-dotenv = "^1.0.0" [build-system]