import requests


def get_public_key(repo):
    """ Get a public key for the repository from travis. """

    url = 'https://api.travis-ci.org/repos/%s' % repo
    response = requests.get(url)

    public_key = response.json().get('public_key', '')

    return public_key.replace('RSA PUBLIC', 'PUBLIC')