class_docstr: Base class for different types of credentials
  
  Note: While subclasses can define their own `_FIELDS`, they are actually
  assumed to have particular keys by the implementation of (some)
  authenticators. `HTTPRequestsAuthenticator` and its subclasses for example,
  assume `user` and `password` to be valid keys.
class_docstr_tok: ["Base","class","for","different","types","of","credentials","Note",":","While","subclasses","can","define","their","own","`","_FIELDS","`",",","they","are","actually","assumed","to","have","particular","keys","by","the","implementation","of","(","some",")","authenticators",".","`","HTTPRequestsAuthenticator","`","and","its","subclasses","for","example",",","assume","`","user","`","and","`","password","`","to","be","valid","keys","."]
docstr: Obtain credentials from a keyring and if any is not known -- ask
  
  Parameters
  ----------
  instructions : str, optional
    If given, the auto-generated instructions based on a login-URL are
    replaced by the given string
code: def __call__(self, instructions=None):
      """Obtain credentials from a keyring and if any is not known -- ask
  
      Parameters
      ----------
      instructions : str, optional
        If given, the auto-generated instructions based on a login-URL are
        replaced by the given string
      """
      fields = {}
      # check if we shall ask for credentials, even if some are on record
      # already (but maybe they were found to need updating)
      force_reentry = dlcfg.obtain(
          "datalad.credentials.force-ask", valtype=anything2bool
      )
      for f in self._FIELDS:
          # don't query for value if we need to get a new one
          v = None if force_reentry else self._get_field_value(f)
          if not self._is_field_optional(f):
              while v is None:  # was not known
                  v = self._ask_and_set(f, instructions=instructions)
              fields[f] = v
          elif v is not None:
              fields[f] = v
      return fields
  
imports: import time
  from ..support.exceptions import AccessDeniedError, CapturedException
  from ..support.keyring_ import keyring
  from ..ui import ui
  from ..utils import auto_repr
  from ..support.network import iso8601_to_epoch
  from datalad import cfg
  from datalad.config import anything2bool
  from datalad.distribution.dataset import Dataset
  from datalad.local.gitcredential import GitCredentialInterface
  from logging import getLogger
label_desc: Use image node_id 9 for calling the Credential obj's underlying member method code with example usage: obj.__call__(instructions) and returns: fields