File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed
Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -256,11 +256,17 @@ def load_credentials(filename=None, account_type=None):
256256 with open (os .path .expanduser (filename )) as f :
257257 search_creds = yaml .load (f )["twitter_search_api" ]
258258
259- if account_type == "premium" :
260- search_args = {"bearer_token" : search_creds ["bearer_token" ],
261- "endpoint" : search_creds ["endpoint" ]}
262- if account_type == "enterprise" :
263- search_args = {"username" : search_creds ["username" ],
264- "password" : search_creds ["password" ],
265- "endpoint" : search_creds ["endpoint" ]}
259+ try :
260+
261+ if account_type == "premium" :
262+ search_args = {"bearer_token" : search_creds ["bearer_token" ],
263+ "endpoint" : search_creds ["endpoint" ]}
264+ if account_type == "enterprise" :
265+ search_args = {"username" : search_creds ["username" ],
266+ "password" : search_creds ["password" ],
267+ "endpoint" : search_creds ["endpoint" ]}
268+ except KeyError :
269+ logger .error ("Your YAML file ({}) is not configured correctly and "
270+ " is missing a required field. Please see the "
271+ " readme for proper configuration" .format (filename ))
266272 return search_args
You can’t perform that action at this time.
0 commit comments