From 4557f6c254090c897efa5d489ccfbc9c1f608941 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=88=9A=28noham=29=C2=B2?= <100566912+NohamR@users.noreply.github.com> Date: Wed, 21 Aug 2024 22:45:15 +0200 Subject: [PATCH] fix env --- README.md | 10 +++++++++- gopload.py | 16 +++++++--------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 06f6505..df8edeb 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,10 @@ create .env based on .env.example -python gopload.py -i 'file.txt' \ No newline at end of file +python gopload.py -i 'file.txt' + +Windows : +setx GOPLOAD_TOKEN = "XXXXXXX" (from https://gofile.io/myProfile) +setx GOPLOAD_PRIVATE_PARENT_ID = "UUID" + +Linux/MacOS : +export GOPLOAD_TOKEN = "XXXXXXX" (from https://gofile.io/myProfile) +export GOPLOAD_PRIVATE_PARENT_ID = "UUID" \ No newline at end of file diff --git a/gopload.py b/gopload.py index c00ffdb..4b63107 100755 --- a/gopload.py +++ b/gopload.py @@ -4,7 +4,6 @@ import random import time import argparse import os -from dotenv import load_dotenv import logging import sys @@ -192,18 +191,17 @@ if __name__ == "__main__": logging.basicConfig(level=getattr(logging, args.log_level.upper()),format=log_format,datefmt="%H:%M:%S",) logger = logging.getLogger(__name__) - load_dotenv() - TOKEN = os.getenv("TOKEN") - PRIVATE_PARENT_ID = os.getenv("PRIVATE_PARENT_ID") + TOKEN = os.getenv("GOPLOAD_TOKEN") + PRIVATE_PARENT_ID = os.getenv("GOPLOAD_PRIVATE_PARENT_ID") if not TOKEN: - logger.error("Error: TOKEN not found, create a .env file with TOKEN") - sys.exit("Error: TOKEN not found, create a .env file with TOKEN") + logger.error("Error: TOKEN not found, add GOPLOAD_TOKEN to your environment variables") + sys.exit("Error: TOKEN not found, add GOPLOAD_TOKEN to your environment variables") if not PRIVATE_PARENT_ID: - logger.error("Error: PRIVATE_PARENT_ID not found, create a .env file with PRIVATE_PARENT_ID") - sys.exit("Error: PRIVATE_PARENT_ID not found, create a .env file with PRIVATE_PARENT_ID") + logger.error("Error: TOKEN not found, add GOPLOAD_PRIVATE_PARENT_ID to your environment variables") + sys.exit("Error: TOKEN not found, add GOPLOAD_PRIVATE_PARENT_ID to your environment variables") if args.name and not args.parent: - logger.warning("Parent folder id not specified, PRIVATE_PARENT_ID will be used") + logger.warning("Parent folder id not specified, GOPLOAD_PRIVATE_PARENT_ID will be used") if args.file: if args.folder: