Change from manual URL construction to using a lib

Makes the code cleaner to read and more resilient to changes

Fixes https://jira.coreos.com/browse/QUAY-940
This commit is contained in:
Joseph Schorr 2018-05-22 13:09:48 -04:00
parent e33760fcd2
commit 648590c356
13 changed files with 85 additions and 56 deletions

View file

@ -25,14 +25,7 @@ class OAuthEndpoint(object):
params_copy = copy.copy(self.params)
params_copy.update(parameters)
return OAuthEndpoint(self.base_url, params_copy)
def to_url_prefix(self):
prefix = self.to_url()
if self.params:
return prefix + '&'
else:
return prefix + '?'
def to_url(self):
(scheme, netloc, path, _, fragment) = urlparse.urlsplit(self.base_url)
updated_query = urllib.urlencode(self.params)