File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -349,10 +349,15 @@ def _InitializeStoragesFromSettings(self):
349
349
)
350
350
result [backend ] = Storage (credentials_file )
351
351
elif backend == "dictionary" :
352
- result [backend ] = DictionaryStorage (
353
- self .settings ["save_credentials_dict" ],
354
- self .settings ["save_credentials_key" ],
355
- )
352
+ creds_dict = self .settings .get ("save_credentials_dict" )
353
+ if creds_dict is None :
354
+ raise InvalidConfigError ("Please specify credentials dict" )
355
+
356
+ creds_key = self .settings .get ("save_credentials_key" )
357
+ if creds_key is None :
358
+ raise InvalidConfigError ("Please specify credentials key" )
359
+
360
+ result [backend ] = DictionaryStorage (creds_dict , creds_key )
356
361
elif save_credentials :
357
362
raise InvalidConfigError (
358
363
"Unknown save_credentials_backend: %s" % backend
Original file line number Diff line number Diff line change 36
36
"type" : str ,
37
37
"required" : False ,
38
38
"dependency" : [
39
- {"value" : "file" , "attribute" : ["save_credentials_file" ]}
39
+ {"value" : "file" , "attribute" : ["save_credentials_file" ]},
40
+ {"value" : "dictionary" , "attribute" : ["save_credentials_dict" ]},
41
+ {"value" : "dictionary" , "attribute" : ["save_credentials_key" ]},
40
42
],
41
43
},
42
44
"client_config" : {
84
86
"default" : ["https://www.googleapis.com/auth/drive" ],
85
87
},
86
88
"save_credentials_file" : {"type" : str , "required" : False },
89
+ "save_credentials_dict" : {"type" : dict , "required" : False },
90
+ "save_credentials_key" : {"type" : str , "required" : False },
87
91
}
88
92
89
93
You can’t perform that action at this time.
0 commit comments