Update env variables
This commit is contained in:
parent
41f0b57275
commit
0d8dac8ab9
@ -7,15 +7,12 @@ from influxdb_client.client.write_api import SYNCHRONOUS
|
||||
from dotenv import load_dotenv, dotenv_values
|
||||
|
||||
load_dotenv()
|
||||
dotenv_file = os.path.realpath(os.path.dirname(__file__)) + "/.env"
|
||||
config = dotenv_values(dotenv_file)
|
||||
# dotenv_file = os.path.realpath(os.path.dirname(__file__)) + "/.env"
|
||||
# config = dotenv_values(dotenv_file)
|
||||
|
||||
EMAIL_ACCOUNTS = json.loads(os.environ.get("MAIL_ACCOUNTS"))
|
||||
EMAIL_PASSWORDS = json.loads(os.environ.get("MAIL_PASSWORDS"))
|
||||
|
||||
# print()
|
||||
# print(config['DB_URL'])
|
||||
# print()
|
||||
# using zip()
|
||||
# to convert lists to dictionary
|
||||
accounts = dict(zip(EMAIL_ACCOUNTS, EMAIL_PASSWORDS))
|
||||
@ -23,9 +20,9 @@ accounts = dict(zip(EMAIL_ACCOUNTS, EMAIL_PASSWORDS))
|
||||
|
||||
# Influx DB
|
||||
client = influxdb_client.InfluxDBClient(
|
||||
url=config['DB_URL'],
|
||||
token=config['DB_TOKEN'],
|
||||
org=config['DB_ORG']
|
||||
url=os.environ.get('DB_URL'),
|
||||
token=os.environ.get('DB_TOKEN'),
|
||||
org=os.environ.get('DB_ORG')
|
||||
)
|
||||
|
||||
################ IMAP SSL ##############################
|
||||
@ -66,8 +63,5 @@ for account in accounts:
|
||||
point = influxdb_client.Point("unread_emails").time(timestamp).tag("account", account)\
|
||||
.field("count", unread_messages)
|
||||
write_api.write(bucket="personal_data",
|
||||
org=config['DB_ORG'], record=point)
|
||||
org=os.environ.get('DB_ORG'), record=point)
|
||||
print(message)
|
||||
|
||||
print(
|
||||
f"File location using __file__ variable: {os.path.realpath(os.path.dirname(__file__))}")
|
||||
|
Loading…
Reference in New Issue
Block a user