Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# set options
if conf.has_section('SYS'):
# get user defined values for timeouts
URLOPEN_TIMEOUT = float(conf.get('SYS', 'URLOPEN_TIMEOUT'))
THREADS_TIMEOUT = float(conf.get('SYS', 'THREADS_TIMEOUT'))
if conf.has_section('SERVICES'):
for o, v in conf.items('SERVICES'):
if o.upper() == 'DEFAULT_SERVICE':
registry.setdefaultservice(v)
continue
if 'api_key' in o: # pragma: no cover
name = o[:-8]
config.add_apikey(name, v)
else:
config.set_option(o.upper(), v)
if conf.has_section('MISC'): # pragma: no cover
for o, v in conf.items('MISC'):
config.set_option(o.upper(), v)
if conf.has_section('MODULES'): # pragma: no cover
for o, v in conf.items('MODULES'):
config.set_option(o.upper(), v)
# URLOPEN_TIMEOUT is used by webservice.py
config.seturlopentimeout(URLOPEN_TIMEOUT)
# THREADS_TIMEOUT is used by vias.py
config.setthreadstimeout(THREADS_TIMEOUT)
# set CONF_PATH
THREADS_TIMEOUT = float(conf.get('SYS', 'THREADS_TIMEOUT'))
if conf.has_section('SERVICES'):
for o, v in conf.items('SERVICES'):
if o.upper() == 'DEFAULT_SERVICE':
registry.setdefaultservice(v)
continue
if 'api_key' in o: # pragma: no cover
name = o[:-8]
config.add_apikey(name, v)
else:
config.set_option(o.upper(), v)
if conf.has_section('MISC'): # pragma: no cover
for o, v in conf.items('MISC'):
config.set_option(o.upper(), v)
if conf.has_section('MODULES'): # pragma: no cover
for o, v in conf.items('MODULES'):
config.set_option(o.upper(), v)
# URLOPEN_TIMEOUT is used by webservice.py
config.seturlopentimeout(URLOPEN_TIMEOUT)
# THREADS_TIMEOUT is used by vias.py
config.setthreadstimeout(THREADS_TIMEOUT)
# set CONF_PATH
if not CONF_PATH:
if VIRTUAL:
CONF_PATH = os.path.join(sys.prefix, 'isbntools')
else: