Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if self.CONFIG_NAME_PROXY in config_data:
configuration.proxy = config_data[self.CONFIG_NAME_PROXY]
# Cert File
if self.CONFIG_NAME_SSL_CA_CERT in config_data:
configuration.ssl_ca_cert = config_data[
self.CONFIG_NAME_SSL_CA_CERT]
# Keep config values with class instance, and load api client!
self.config_values = config_data
try:
self.api_client = ApiClient(configuration)
except Exception as error:
if 'Proxy' in type(error).__name__:
raise ValueError(
'The specified proxy ' +
config_data[self.CONFIG_NAME_PROXY] +
' is not valid, please check your proxy settings')
else:
raise ValueError(
'Unauthorized: you must download an API key or export '
'credentials to the environment. Please see\n ' +
'https://github.com/Kaggle/kaggle-api#api-credentials ' +
'for instructions.')
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client