1
0
Fork 0
mirror of synced 2024-09-29 08:41:56 +13:00

Changed config.json path

This commit is contained in:
Ali Parlakci 2018-07-13 14:10:21 +03:00
parent 1e8eaa1a8d
commit 5e3c79160b
3 changed files with 6 additions and 4 deletions

View file

@ -609,8 +609,9 @@ def main():
print(err) print(err)
sys.exit() sys.exit()
GLOBAL.config = getConfig("config.json") if not Path(GLOBAL.configDirectory).is_dir():
os.makedirs(GLOBAL.configDirectory)
GLOBAL.config = getConfig(GLOBAL.configDirectory / "config.json")
if GLOBAL.arguments.log is not None: if GLOBAL.arguments.log is not None:
logDir = Path(GLOBAL.arguments.log) logDir = Path(GLOBAL.arguments.log)

View file

@ -89,7 +89,7 @@ def beginPraw(config,user_agent = str(socket.gethostname())):
authorizedInstance = GetAuth(reddit,port).getRefreshToken(*scopes) authorizedInstance = GetAuth(reddit,port).getRefreshToken(*scopes)
reddit = authorizedInstance[0] reddit = authorizedInstance[0]
refresh_token = authorizedInstance[1] refresh_token = authorizedInstance[1]
jsonFile("config.json").add({ jsonFile(GLOBAL.configDirectory / "config.json").add({
"reddit_refresh_token":refresh_token "reddit_refresh_token":refresh_token
}) })
else: else:
@ -98,7 +98,7 @@ def beginPraw(config,user_agent = str(socket.gethostname())):
authorizedInstance = GetAuth(reddit,port).getRefreshToken(*scopes) authorizedInstance = GetAuth(reddit,port).getRefreshToken(*scopes)
reddit = authorizedInstance[0] reddit = authorizedInstance[0]
refresh_token = authorizedInstance[1] refresh_token = authorizedInstance[1]
jsonFile("config.json").add({ jsonFile(GLOBAL.configDirectory / "config.json").add({
"reddit_refresh_token":refresh_token "reddit_refresh_token":refresh_token
}) })
return reddit return reddit

View file

@ -14,6 +14,7 @@ class GLOBAL:
config = None config = None
arguments = None arguments = None
directory = None directory = None
configDirectory = Path.home() / "Bulk Downloader for Reddit"
reddit_client_id = "BSyphDdxYZAgVQ" reddit_client_id = "BSyphDdxYZAgVQ"
reddit_client_secret = "bfqNJaRh8NMh-9eAr-t4TRz-Blk" reddit_client_secret = "bfqNJaRh8NMh-9eAr-t4TRz-Blk"
printVanilla = print printVanilla = print