commit 67392b22a92ea6e5645d7a7f6a1f9498022f2958
parent cfc087cd4f225779df64c9f28886ab4996f06209
Author: pyratebeard <root@pyratebeard.net>
Date: Sun, 25 Oct 2026 22:15:22 +0000
fix(wmt.py): add cwd to .env. getenv access_token
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/wmt.py b/wmt.py
@@ -41,7 +41,8 @@ from mastodon import Mastodon
# pull vars and secrets from .env file
# if the file does not exist write the
# required vars to a new file and exit
-var_file = '.env'
+cwd = os.path.dirname(os.path.realpath(__file__))
+var_file = cwd + '/.env'
local_vars = ['NAVIDROME_URL', # instance url
'USERNAME', # navidrome username
'PASSWORD', # navidrome password
@@ -137,6 +138,7 @@ for album in week_music:
# post toot
try:
MASTODON_URL = os.getenv("MASTODON_URL")
+ ACCESS_TOKEN = os.getenv("ACCESS_TOKEN")
mastodon = Mastodon(api_base_url = MASTODON_URL, access_token = ACCESS_TOKEN)
mastodon.toot(toot)
except Exception as e: