mirror of
https://github.com/KevinMidboe/bulk-downloader-for-reddit.git
synced 2025-10-29 09:30:15 +00:00
Fixed saving auth info problem
This commit is contained in:
@@ -674,8 +674,11 @@ def main():
|
|||||||
|
|
||||||
if not Path(GLOBAL.configDirectory).is_dir():
|
if not Path(GLOBAL.configDirectory).is_dir():
|
||||||
os.makedirs(GLOBAL.configDirectory)
|
os.makedirs(GLOBAL.configDirectory)
|
||||||
GLOBAL.config = getConfig("config.json") if Path("config.json").exists() \
|
|
||||||
else getConfig(GLOBAL.configDirectory / "config.json")
|
GLOBAL.configDirectory = Path("config.json") if Path("config.json").exists() \
|
||||||
|
else GLOBAL.defaultConfigDirectory / "config.json"
|
||||||
|
|
||||||
|
GLOBAL.config = getConfig(GLOBAL.configDirectory)
|
||||||
|
|
||||||
if GLOBAL.arguments.log is not None:
|
if GLOBAL.arguments.log is not None:
|
||||||
logDir = Path(GLOBAL.arguments.log)
|
logDir = Path(GLOBAL.arguments.log)
|
||||||
|
|||||||
@@ -95,7 +95,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(GLOBAL.configDirectory / "config.json").add({
|
jsonFile(GLOBAL.configDirectory).add({
|
||||||
"reddit_username":str(reddit.user.me()),
|
"reddit_username":str(reddit.user.me()),
|
||||||
"reddit_refresh_token":refresh_token
|
"reddit_refresh_token":refresh_token
|
||||||
})
|
})
|
||||||
@@ -105,7 +105,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(GLOBAL.configDirectory / "config.json").add({
|
jsonFile(GLOBAL.configDirectory).add({
|
||||||
"reddit_username":str(reddit.user.me()),
|
"reddit_username":str(reddit.user.me()),
|
||||||
"reddit_refresh_token":refresh_token
|
"reddit_refresh_token":refresh_token
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ class GLOBAL:
|
|||||||
config = None
|
config = None
|
||||||
arguments = None
|
arguments = None
|
||||||
directory = None
|
directory = None
|
||||||
configDirectory = Path.home() / "Bulk Downloader for Reddit"
|
defaultConfigDirectory = Path.home() / "Bulk Downloader for Reddit"
|
||||||
|
configDirectory = ""
|
||||||
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
|
||||||
|
|||||||
Reference in New Issue
Block a user