def get_deployment_id(deployment_name,
                      token_manager=None,
                      app_url=defaults.APP_URL):
    """
    return the deployment id for the deployment with the specified name

    """

    headers = token_manager.get_access_token_headers()
    deployment_url = environment.get_deployment_url(app_url=app_url)
    response = requests.get('%s/api/v1/deployments' % deployment_url,
                            headers=headers)

    if response.status_code == 200:
        deployments = response.json()

        for deployment in deployments:
            if deployment['name'] == deployment_name:
                return deployment['deployment_id']

        raise JutException('Unable to find deployment with name %s' % deployment_name)
    else:
        raise JutException('Error %s: %s' % (response.status_code, response.text))
dataset/ETHPy150Open jut-io/jut-python-tools/jut/api/deployments.py/get_deployment_id/original