import requests


def login(url, auth, **kwargs):
    """
    Requires a url and (username, password) tuple, and returns a session token
    to be passed with future requests.
    """

    url = '{0}/v1/session/add'.format(url)

    response = requests.post(url, auth=auth, verify=kwargs.get('verify', True))
    response.raise_for_status()

    return response.headers.get('X-Zerto-Session')