Compare commits

...

2 Commits

Author SHA1 Message Date
81cd95924e Get credentials 2022-05-27 00:12:23 +05:30
fbecb310a5 fixed typo 2022-05-27 00:11:06 +05:30
2 changed files with 28 additions and 2 deletions

27
app.py
View File

@ -0,0 +1,27 @@
import json
from sys import argv
from pathlib import Path
import requests
# Get API key and Email address
def getCredentials():
api_key = input("Enter the Cloudflare API key: ")
email_address = input("Enter the Cloudflare Email address: ")
return {"api_key": api_key, "email": email_address}
# Get credentials
if len(argv) > 1 and 'loadconfig' in argv:
if Path("config.json").exists():
configfile = open("config.json")
config = json.load(configfile)
credentials = {'api_key': config['API_Key'], 'email': config['Email']}
else:
print('config.json was not found. Please enter the credentials manually')
credentials = getCredentials()
else:
credentials = getCredentials()
# print(credentials)

View File

@ -1,5 +1,4 @@
{
"saveCredentials": true,
"API_KEY": "your api key goes here",
"API_Key": "your api key goes here",
"Email": "your cloudflare email address"
}