Correct Path to .env file
This commit is contained in:
parent
9c08687f25
commit
b202889766
@ -7,7 +7,9 @@ from influxdb_client.client.write_api import SYNCHRONOUS
|
|||||||
from dotenv import load_dotenv, dotenv_values
|
from dotenv import load_dotenv, dotenv_values
|
||||||
|
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
config = dotenv_values(".env")
|
dotenv_file = os.path.realpath(os.path.dirname(__file__)) + "/.env"
|
||||||
|
print(dotenv_file)
|
||||||
|
config = dotenv_values(dotenv_file)
|
||||||
|
|
||||||
EMAIL_ACCOUNTS = json.loads(os.environ.get("MAIL_ACCOUNTS"))
|
EMAIL_ACCOUNTS = json.loads(os.environ.get("MAIL_ACCOUNTS"))
|
||||||
EMAIL_PASSWORDS = json.loads(os.environ.get("MAIL_PASSWORDS"))
|
EMAIL_PASSWORDS = json.loads(os.environ.get("MAIL_PASSWORDS"))
|
||||||
@ -57,9 +59,12 @@ for account in accounts:
|
|||||||
date = strftime("%Y-%m-%d")
|
date = strftime("%Y-%m-%d")
|
||||||
time = strftime("%H:%M:%S")
|
time = strftime("%H:%M:%S")
|
||||||
timestamp = date + "T" + time + "Z"
|
timestamp = date + "T" + time + "Z"
|
||||||
write_api = client.write_api(write_options=SYNCHRONOUS)
|
# write_api = client.write_api(write_options=SYNCHRONOUS)
|
||||||
point = influxdb_client.Point("unread_emails").time(timestamp).tag("account", account)\
|
# point = influxdb_client.Point("unread_emails").time(timestamp).tag("account", account)\
|
||||||
.field("count", unread_messages)
|
# .field("count", unread_messages)
|
||||||
write_api.write(bucket="personal_data",
|
# write_api.write(bucket="personal_data",
|
||||||
org=config['DB_ORG'], record=point)
|
# org=config['DB_ORG'], record=point)
|
||||||
print(message)
|
print(message)
|
||||||
|
|
||||||
|
print(
|
||||||
|
f"File location using __file__ variable: {os.path.realpath(os.path.dirname(__file__))}")
|
||||||
|
Loading…
Reference in New Issue
Block a user