Skip to content

Commit

Permalink
Fix path building (#52)
Browse files Browse the repository at this point in the history
Fix bug with alias path building when we use a custom indexd base URL
  • Loading branch information
paulineribeyre authored Sep 24, 2019
1 parent 7fbb873 commit 3845053
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions indexclient/client.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
try:
from urlparse import urljoin
except ImportError:
from urllib.parse import urljoin

import copy
import json

Expand Down Expand Up @@ -66,7 +61,8 @@ def __init__(self, baseurl, version="v0", auth=None):
self.version = version

def url_for(self, *path):
return urljoin(self.url, "/".join(path))
subpath = "/".join(path).lstrip("/")
return "{}/{}".format(self.url.rstrip("/"), subpath)

def check_status(self):
"""Check that the API we are trying to communicate with is online"""
Expand Down Expand Up @@ -308,7 +304,7 @@ def create_alias(
"keeper_authority": keeper_authority,
}
)
url = "/alias/" + record
url = "alias/" + record
headers = {"content-type": "application/json"}
resp = self._put(url, headers=headers, data=data, auth=self.auth)
return resp.json()
Expand Down

0 comments on commit 3845053

Please sign in to comment.