sregistry/main/workers/aws.py
def update_token(headers):
    '''update_token uses HTTP basic authentication to attempt to authenticate
    given a 401 response. We take as input previous headers, and update 
    them.

    Parameters
    ==========
    response: the http request response to parse for the challenge.
    
    '''
    try:
        from awscli.clidriver import create_clidriver
    except:
        bot.exit('Please install pip install sregistry[aws]')

    driver = create_clidriver()
    aws = driver.session.create_client('ecr')
    tokens = aws.get_authorization_token()
    token = tokens['authorizationData'][0]['authorizationToken']    

    try:
        token = {"Authorization": "Basic %s" % token}
        headers.update(token)

    except Exception:
        bot.error("Error getting token.")
        sys.exit(1)

    return headers
def update_token(headers):
    '''update_token uses HTTP basic authentication to attempt to authenticate
    given a 401 response. We take as input previous headers, and update 
    them.

    Parameters
    ==========
    response: the http request response to parse for the challenge.
    
    '''
    try:
        from awscli.clidriver import create_clidriver
    except:
        bot.exit('Please install pip install sregistry[aws]')

    driver = create_clidriver()
    aws = driver.session.create_client('ecr')
    tokens = aws.get_authorization_token()
    token = tokens['authorizationData'][0]['authorizationToken']    

    try:
        token = {"Authorization": "Basic %s" % token}
        headers.update(token)

    except Exception:
        bot.error("Error getting token.")
        sys.exit(1)

    return headers
def update_token ( headers ) : try : from awscli . clidriver import create_clidriver except : bot . exit ( 'Please install pip install sregistry[aws]' ) driver = create_clidriver ( ) aws = driver . session . create_client ( 'ecr' ) tokens = aws . get_authorization_token ( ) token = tokens [ 'authorizationData' ] [ 0 ] [ 'authorizationToken' ] try : token = { "Authorization" : "Basic %s" % token } headers . update ( token ) except Exception : bot . error ( "Error getting token." ) sys . exit ( 1 ) return headers
update_token uses HTTP basic authentication to attempt to authenticate
    given a 401 response. We take as input previous headers, and update 
    them.

    Parameters
    ==========
    response: the http request response to parse for the challenge.
update_token uses HTTP basic authentication to attempt to authenticate given a 401 response . We take as input previous headers and update them .