Skip to content

Commit

Permalink
Merge pull request #18 from slaclab/python3
Browse files Browse the repository at this point in the history
Urllib fixes
  • Loading branch information
brianv0 authored Oct 8, 2018
2 parents 2cbb1de + 054956d commit 82f1891
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions client/python/datacat/http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
import logging
import os
import requests
import urllib

try:
from urllib.parse import quote
except ImportError:
from urllib import quote

from .config import ENDPOINTS, DATATYPES

_logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -259,7 +264,7 @@ def resource(_endpoint, _accept):
def resolve(_path, part):
_path = _path if _path[-1] != '/' else _path[:-1]
part = part if part[0] != '/' else (part[1:] if len(part) > 0 else "")
return "%s/%s" % (_path, urllib.quote(part, safe="/*$"))
return "%s/%s" % (_path, quote(part, safe="/*$"))

url = resolve(self.base_url, resource(endpoint, self.accept))
view = ";v=" + str(version) if version is not None else ""
Expand Down

0 comments on commit 82f1891

Please sign in to comment.