in git_remote_codecommit/__init__.py [0:0]
def git_url(repository, version, region, credentials):
"""
Provides the signed url we can use for pushing and pulling from CodeCommit...
::
https://(username):(password)@git-codecommit.(region).(website_domain)/v1/repos/(repository)
:param str repository: repository name
:param str version: protocol version for this hook
:param str region: region the repository resides within
:param botocore.credentials credentials: session credentials
:return: url we can push/pull from
"""
hostname = os.environ.get('CODE_COMMIT_ENDPOINT', 'git-codecommit.{}.{}'.format(region, website_domain_mapping(region)))
path = '/{}/repos/{}'.format(version, repository)
token = '%' + credentials.token if credentials.token else ''
username = botocore.compat.quote(credentials.access_key + token, safe='')
signature = sign(hostname, path, region, credentials)
return 'https://{}:{}@{}{}'.format(username, signature, hostname, path)