add comments

This commit is contained in:
Mylloon 2021-08-24 10:22:50 +02:00
parent 4e9b2f5608
commit e9776b97b1

14
main.py
View file

@ -100,25 +100,25 @@ def save(elements):
if __name__ == "__main__":
argv = argv[1:]
if len(argv) < 1:
if len(argv) < 1: # no args
print("No App to retrieve.")
exit(1)
load_dotenv()
try:
load_dotenv() # load .env file
try:
try: # for logs
debug = environ["DEBUG_MOBILISM"].lower() in ("yes", "true", "1")
except:
debug = False
try:
try: # try to fetch credentials from de .env first
pseudoMobilism = environ["PSEUDO_MOBILISM"]
passwordMobilism = environ["PASSWORD_MOBILISM"]
except:
except: # if it failed try to get from the cli
if len(argv) >= 3:
pseudoMobilism = argv[0]
passwordMobilism = argv[1]
argv = argv[-2:]
else:
else: # if it failed again there is a problem
raise KeyError
save(Scraper(pseudoMobilism, passwordMobilism, " ".join([n for n in argv]), debug).work())
save(Scraper(pseudoMobilism, passwordMobilism, " ".join([n for n in argv]), debug).work()) # call the work() function
except KeyError:
print('Please fill in the username and password (with quotes) by args or with .env file and give an app to retrieve.')