Added loading api params from dotenv file
This commit is contained in:
parent
fc7e6665a0
commit
819707af10
4 changed files with 32 additions and 2 deletions
4
.env-example
Normal file
4
.env-example
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
URL="https://camisatoshi.com"
|
||||
CONSUMER_KEY=
|
||||
CONSUMER_SECRET=
|
||||
VERSION="wc/v3"
|
||||
|
|
@ -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..."
|
||||
)
|
||||
)
|
||||
print(Path("~/.camisatoshi-wordpress-reports/.env"))
|
||||
print(f"By the way, I found this: {API_CONFIG}")
|
||||
|
|
|
|||
16
poetry.lock
generated
16
poetry.lock
generated
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue