# 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
    :returns: A :class:`Search` object, yielding search results.
    """
    if not archive_session:
        archive_session = get_session(config, config_file, http_adapter_kwargs)
    return archive_session.search_items(query,
                                        fields=fields,
                                        sorts=sorts,
                                        params=params,
                                        full_text_search=full_text_search,
                                        dsl_fts=dsl_fts,
                                        request_kwargs=request_kwargs,
                                        max_retries=max_retries)


def configure(username=None, password=None, config_file=None, host=None):
    """Configure internetarchive with your Archive.org credentials.

    :type username: str
    :param username: The email address associated with your Archive.org account.

    :type password: str
    :param password: Your Archive.org password.

    Usage:
        >>> from internetarchive import configure
        >>> configure('user@example.com', 'password')
    """
    username = input('Email address: ') if not username else username
    password = getpass('Password: ') if not password else password
    auth_config = config_module.get_auth_config(username, password, host)

# 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

    :returns: A :class:`Search` object, yielding search results.
    """
    if not archive_session:
        archive_session = get_session(config, config_file, http_adapter_kwargs)
    return archive_session.search_items(query,
                                        fields=fields,
                                        sorts=sorts,
                                        params=params,
                                        full_text_search=full_text_search,
                                        dsl_fts=dsl_fts,
                                        request_kwargs=request_kwargs,
                                        max_retries=max_retries)


def configure(username=None, password=None, config_file=None, host=None):
    """Configure internetarchive with your Archive.org credentials.

    :type username: str
    :param username: The email address associated with your Archive.org account.

    :type password: str
    :param password: Your Archive.org password.

    Usage:
        >>> from internetarchive import configure
        >>> configure('user@example.com', 'password')
    """
    username = input('Email address: ') if not username else username
    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)