def CreateHttpHeader(self):
    """Creates an OAuth2 HTTP header.

    The OAuth2 credentials will be refreshed as necessary. In the event that
    the credentials fail to refresh, a message is logged but no exception is
    raised.

    Returns:
      A dictionary containing one entry: the OAuth2 Bearer header under the
      'Authorization' key.

    Raises:
      google.auth.exceptions.RefreshError: If the refresh fails.
    """
    oauth2_header = {}

    if self.creds.expiry is None or self.creds.expired:
      self.Refresh()

    self.creds.apply(oauth2_header)
    return oauth2_header