File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -99,13 +99,17 @@ def authenticate(self):
99
99
100
100
config_data = {}
101
101
102
- # Step 1: read in configuration file, if it exists
103
- if os .path .exists (self .config ):
104
- config_data = self .read_config_file (config_data )
105
-
106
- # Step 2:, get username/password from environment
102
+ # Step 1: try getting username/password from environment
107
103
config_data = self .read_config_environment (config_data )
108
104
105
+ # Step 2: if credentials were not in environment read in configuration file
106
+ if 'username' not in config_data or 'key' not in config_data :
107
+ if os .path .exists (self .config ):
108
+ config_data = self .read_config_file (config_data )
109
+ else :
110
+ raise IOError ('Could not find kaggle.json. Make sure it\' s located in {}.'
111
+ ' Or use the environment method.' .format (self .config_dir ))
112
+
109
113
# Step 3: load into configuration!
110
114
self ._load_config (config_data )
111
115
You can’t perform that action at this time.
0 commit comments