def __init__(self, source=None, log_level=None, **session_opts): """Constructor.""" try: self.source = sources[source.upper()] if source else NoSource except KeyError: raise ValueError('source must be None or one of: %s' % ' '.join(list_sources())) self.session = remote.Session(**session_opts) if log_level: logging.getLogger('pandasdmx').setLevel(log_level)
def __init__(self, source=None, log_level=None, session=None, **session_opts): """Constructor.""" try: self.source = sources[source.upper()] if source else NoSource except KeyError: raise ValueError( "source must be None or one of: %s" % " ".join(list_sources()) ) if session and session_opts: raise TypeError("When `session` is given, `session_opts` must be empty.") self.session = session or remote.Session(**session_opts) if log_level: logging.getLogger("pandasdmx").setLevel(log_level)