Skip to content

Commit 9c1cc0c

Browse files
committed
remove url encoding, rely on default encoding from tools as needed
1 parent 6b0ecb0 commit 9c1cc0c

2 files changed

Lines changed: 5 additions & 19 deletions

File tree

hsclient/hydroshare.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151

5252
from hsclient.json_models import ResourcePreview, User
5353
from hsclient.oauth2_model import Token
54-
from hsclient.utils import attribute_filter, encode_resource_url, is_aggregation, main_file_type
54+
from hsclient.utils import attribute_filter, is_aggregation, main_file_type
5555

5656
import pkg_resources # part of setuptools
5757
VERSION = pkg_resources.get_distribution(__package__).version
@@ -1429,7 +1429,7 @@ def upload_file(self, path, files, status_code=204):
14291429
return self.post(path, files=files, status_code=status_code)
14301430

14311431
def post(self, path, status_code, data=None, params={}, **kwargs):
1432-
url = encode_resource_url(self._build_url(path))
1432+
url = self._build_url(path)
14331433
response = self._session.post(url, params=params, data=data, **kwargs)
14341434
if response.status_code != status_code:
14351435
raise Exception(
@@ -1438,7 +1438,7 @@ def post(self, path, status_code, data=None, params={}, **kwargs):
14381438
return response
14391439

14401440
def put(self, path, status_code, data=None, **kwargs):
1441-
url = encode_resource_url(self._build_url(path))
1441+
url = self._build_url(path)
14421442
response = self._session.put(url, data=data, **kwargs)
14431443
if response.status_code != status_code:
14441444
raise Exception(
@@ -1447,7 +1447,7 @@ def put(self, path, status_code, data=None, **kwargs):
14471447
return response
14481448

14491449
def get(self, path, status_code, **kwargs):
1450-
url = encode_resource_url(self._build_url(path))
1450+
url = self._build_url(path)
14511451
response = self._session.get(url, **kwargs)
14521452
if response.status_code != status_code:
14531453
raise Exception(
@@ -1456,7 +1456,7 @@ def get(self, path, status_code, **kwargs):
14561456
return response
14571457

14581458
def delete(self, path, status_code, **kwargs):
1459-
url = encode_resource_url(self._build_url(path))
1459+
url = self._build_url(path)
14601460
response = self._session.delete(url, **kwargs)
14611461
if response.status_code != status_code:
14621462
raise Exception(

hsclient/utils.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,6 @@ def attribute_filter(o, key, value) -> bool:
5252
return attr == value
5353

5454

55-
def encode_resource_url(url):
56-
"""
57-
URL encodes a full resource file/folder url.
58-
:param url: a string url
59-
:return: url encoded string
60-
"""
61-
import urllib
62-
63-
parsed_url = urllib.parse.urlparse(url)
64-
url_encoded_path = pathname2url(parsed_url.path)
65-
encoded_url = parsed_url._replace(path=url_encoded_path).geturl()
66-
return encoded_url
67-
68-
6955
def is_folder(path):
7056
"""Checks for an extension to determine if the path is to a folder"""
7157
return splitext(path)[1] == ''

0 commit comments

Comments
 (0)