# Path: internetarchive/session.py
# class ArchiveSession(requests.sessions.Session):
#     ITEM_MEDIATYPE_TABLE = {
#         'collection': Collection,
#     }
#     def __init__(self,
#                  config=None,
#                  config_file=None,
#                  debug=None,
#                  http_adapter_kwargs=None):
#     def _get_user_agent_string(self):
#     def rebuild_auth(self, prepared_request, response):
#     def mount_http_adapter(self, protocol=None, max_retries=None,
#                            status_forcelist=None, host=None):
#     def set_file_logger(self, log_level, path, logger_name='internetarchive'):
#     def get_item(self, identifier, item_metadata=None, request_kwargs=None):
#     def get_metadata(self, identifier, request_kwargs=None):
#     def search_items(self, query,
#                      fields=None,
#                      sorts=None,
#                      params=None,
#                      full_text_search=None,
#                      dsl_fts=None,
#                      request_kwargs=None,
#                      max_retries=None):
#     def s3_is_overloaded(self, identifier=None, access_key=None, request_kwargs=None):
#     def get_tasks_api_rate_limit(self, cmd='derive.php', request_kwargs=None):
#     def submit_task(self, identifier, cmd, comment=None, priority=None, data=None,
#                     headers=None, reduced_priority=None, request_kwargs=None):
#     def iter_history(self, identifier, params=None, request_kwargs=None):
#     def iter_catalog(self, identifier=None, params=None, request_kwargs=None):
#     def get_tasks_summary(self, identifier=None, params=None, request_kwargs=None):
#     def get_tasks(self, identifier=None, params=None, request_kwargs=None):
#     def get_my_catalog(self, params=None, request_kwargs=None):
#     def get_task_log(self, task_id, request_kwargs=None):
#     def send(self, request, **kwargs):
# 
# Path: internetarchive/config.py
# def get_auth_config(email, password, host=None):
# def write_config_file(auth_config, config_file=None):
# def parse_config_file(config_file=None):
# def get_config(config=None, config_file=None):
# 
# Path: internetarchive/auth.py
# class S3Auth(AuthBase):
# class S3PostAuth(AuthBase):
#     def __init__(self, access_key=None, secret_key=None):
#     def __call__(self, r):
#     def __init__(self, access_key=None, secret_key=None):
#     def __call__(self, r):
# 
# Path: internetarchive/exceptions.py
# class AuthenticationError(Exception):
#     """Authentication Failed"""


from getpass import getpass
from internetarchive import session
from internetarchive import config as config_module
from internetarchive import auth
from internetarchive.exceptions import AuthenticationError
import requests
    password = getpass('Password: ') if not password else password
    auth_config = config_module.get_auth_config(username, password, host)
    config_file_path = config_module.write_config_file(auth_config, config_file)
    return config_file_path


def get_username(access_key, secret_key):
    """Returns an Archive.org username given an IA-S3 key pair.

    :type access_key: str
    :param access_key: IA-S3 access_key to use when making the given request.

    :type secret_key: str
    :param secret_key: IA-S3 secret_key to use when making the given request.
    """
    j = get_user_info(access_key, secret_key)
    return j.get('username')


def get_user_info(access_key, secret_key):
    """Returns details about an Archive.org user given an IA-S3 key pair.

    :type access_key: str
    :param access_key: IA-S3 access_key to use when making the given request.

    :type secret_key: str
    :param secret_key: IA-S3 secret_key to use when making the given request.
    """
    u = 'https://s3.us.archive.org'
    p = {'check_auth': 1}

# Path: internetarchive/session.py
# class ArchiveSession(requests.sessions.Session):
#     ITEM_MEDIATYPE_TABLE = {
#         'collection': Collection,
#     }
#     def __init__(self,
#                  config=None,
#                  config_file=None,
#                  debug=None,
#                  http_adapter_kwargs=None):
#     def _get_user_agent_string(self):
#     def rebuild_auth(self, prepared_request, response):
#     def mount_http_adapter(self, protocol=None, max_retries=None,
#                            status_forcelist=None, host=None):
#     def set_file_logger(self, log_level, path, logger_name='internetarchive'):
#     def get_item(self, identifier, item_metadata=None, request_kwargs=None):
#     def get_metadata(self, identifier, request_kwargs=None):
#     def search_items(self, query,
#                      fields=None,
#                      sorts=None,
#                      params=None,
#                      full_text_search=None,
#                      dsl_fts=None,
#                      request_kwargs=None,
#                      max_retries=None):
#     def s3_is_overloaded(self, identifier=None, access_key=None, request_kwargs=None):
#     def get_tasks_api_rate_limit(self, cmd='derive.php', request_kwargs=None):
#     def submit_task(self, identifier, cmd, comment=None, priority=None, data=None,
#                     headers=None, reduced_priority=None, request_kwargs=None):
#     def iter_history(self, identifier, params=None, request_kwargs=None):
#     def iter_catalog(self, identifier=None, params=None, request_kwargs=None):
#     def get_tasks_summary(self, identifier=None, params=None, request_kwargs=None):
#     def get_tasks(self, identifier=None, params=None, request_kwargs=None):
#     def get_my_catalog(self, params=None, request_kwargs=None):
#     def get_task_log(self, task_id, request_kwargs=None):
#     def send(self, request, **kwargs):
# 
# Path: internetarchive/config.py
# def get_auth_config(email, password, host=None):
# def write_config_file(auth_config, config_file=None):
# def parse_config_file(config_file=None):
# def get_config(config=None, config_file=None):
# 
# Path: internetarchive/auth.py
# class S3Auth(AuthBase):
# class S3PostAuth(AuthBase):
#     def __init__(self, access_key=None, secret_key=None):
#     def __call__(self, r):
#     def __init__(self, access_key=None, secret_key=None):
#     def __call__(self, r):
# 
# Path: internetarchive/exceptions.py
# class AuthenticationError(Exception):
#     """Authentication Failed"""


# Path: internetarchive/api.py
from getpass import getpass
from internetarchive import session
from internetarchive import config as config_module
from internetarchive import auth
from internetarchive.exceptions import AuthenticationError
import requests

    password = getpass('Password: ') if not password else password
    auth_config = config_module.get_auth_config(username, password, host)
    config_file_path = config_module.write_config_file(auth_config, config_file)
    return config_file_path


def get_username(access_key, secret_key):
    """Returns an Archive.org username given an IA-S3 key pair.

    :type access_key: str
    :param access_key: IA-S3 access_key to use when making the given request.

    :type secret_key: str
    :param secret_key: IA-S3 secret_key to use when making the given request.
    """
    j = get_user_info(access_key, secret_key)
    return j.get('username')


def get_user_info(access_key, secret_key):
    """Returns details about an Archive.org user given an IA-S3 key pair.

    :type access_key: str
    :param access_key: IA-S3 access_key to use when making the given request.

    :type secret_key: str
    :param secret_key: IA-S3 secret_key to use when making the given request.
    """
    u = 'https://s3.us.archive.org'
    p = {'check_auth': 1}

    r = requests.get(u, params=p, auth=auth.S3Auth(access_key, secret_key))