add comments
This commit is contained in:
parent
4e9b2f5608
commit
e9776b97b1
1 changed files with 7 additions and 7 deletions
14
main.py
14
main.py
|
@ -100,25 +100,25 @@ def save(elements):
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
argv = argv[1:]
|
argv = argv[1:]
|
||||||
if len(argv) < 1:
|
if len(argv) < 1: # no args
|
||||||
print("No App to retrieve.")
|
print("No App to retrieve.")
|
||||||
exit(1)
|
exit(1)
|
||||||
load_dotenv()
|
load_dotenv() # load .env file
|
||||||
try:
|
try:
|
||||||
try:
|
try: # for logs
|
||||||
debug = environ["DEBUG_MOBILISM"].lower() in ("yes", "true", "1")
|
debug = environ["DEBUG_MOBILISM"].lower() in ("yes", "true", "1")
|
||||||
except:
|
except:
|
||||||
debug = False
|
debug = False
|
||||||
try:
|
try: # try to fetch credentials from de .env first
|
||||||
pseudoMobilism = environ["PSEUDO_MOBILISM"]
|
pseudoMobilism = environ["PSEUDO_MOBILISM"]
|
||||||
passwordMobilism = environ["PASSWORD_MOBILISM"]
|
passwordMobilism = environ["PASSWORD_MOBILISM"]
|
||||||
except:
|
except: # if it failed try to get from the cli
|
||||||
if len(argv) >= 3:
|
if len(argv) >= 3:
|
||||||
pseudoMobilism = argv[0]
|
pseudoMobilism = argv[0]
|
||||||
passwordMobilism = argv[1]
|
passwordMobilism = argv[1]
|
||||||
argv = argv[-2:]
|
argv = argv[-2:]
|
||||||
else:
|
else: # if it failed again there is a problem
|
||||||
raise KeyError
|
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:
|
except KeyError:
|
||||||
print('Please fill in the username and password (with quotes) by args or with .env file and give an app to retrieve.')
|
print('Please fill in the username and password (with quotes) by args or with .env file and give an app to retrieve.')
|
||||||
|
|
Reference in a new issue