class_docstr: Base class for the downloaders
class_docstr_tok: ["Base","class","for","the","downloaders"]
docstr: Parameters
  ----------
  credential: Credential, optional
    Provides necessary credential fields to be used by authenticator
  authenticator: Authenticator, optional
    Authenticator to use for authentication.
docstr_tok: ["Parameters","--","--","--","--","--","credential",":","Credential",",","optional","Provides","necessary","credential","fields","to","be","used","by","authenticator","authenticator",":","Authenticator",",","optional","Authenticator","to","use","for","authentication","."]
code: def __init__(self, credential=None, authenticator=None):
      """
  
      Parameters
      ----------
      credential: Credential, optional
        Provides necessary credential fields to be used by authenticator
      authenticator: Authenticator, optional
        Authenticator to use for authentication.
      """
      if not authenticator and self._DEFAULT_AUTHENTICATOR:
          authenticator = self._DEFAULT_AUTHENTICATOR()
  
      if authenticator and authenticator.requires_authentication:
          if not credential and not authenticator.allows_anonymous:
              msg = (
                  "Both authenticator and credentials must be provided."
                  " Got only authenticator %s" % repr(authenticator)
              )
              if ui.yesno(
                  title=msg,
                  text="Do you want to enter %s credentials to be used?"
                  % authenticator.DEFAULT_CREDENTIAL_TYPE,
              ):
                  credential = CREDENTIAL_TYPES[
                      authenticator.DEFAULT_CREDENTIAL_TYPE
                  ]("session-only-for-%s" % id(authenticator))
                  credential.enter_new()
                  # TODO: give an option to store those credentials, and generate a basic provider
                  # record?
              else:
                  raise ValueError(msg)
      self.credential = credential
      self.authenticator = authenticator
      self._cache = None
  
imports: import msgpack
  import os
  import sys
  import time
  from abc import ABCMeta, abstractmethod
  import os.path
  from os.path import exists, join, isdir
  from ..None import cfg
  from ..ui import ui
  from ..utils import auto_repr, ensure_unicode, unlink
  from .credentials import CompositeCredential
  from datalad.downloaders import CREDENTIAL_TYPES
  from ..support.exceptions import AccessDeniedError, AccessPermissionExpiredError, AnonymousAccessDeniedError, CapturedException, DownloadError, IncompleteDownloadError, UnaccountedDownloadError
  from ..support.locking import InterProcessLock, try_lock, try_lock_informatively
  from logging import getLogger
label_desc: Use image node_id 1 to create a new BaseDownloader object from inherited base classes: object with example: obj = BaseDownloader(credential, authenticator)