Ensure tag update/delete URLs are UTF-8 encoded
This commit is contained in:
parent
43f533a419
commit
d43c8fb379
3 changed files with 34 additions and 9 deletions
|
@ -1,6 +1,11 @@
|
|||
"""
|
||||
api_base.py: Base class for all API classes
|
||||
"""
|
||||
try:
|
||||
from urllib.parse import quote # Python3
|
||||
except ImportError:
|
||||
from urllib import quote # Python2
|
||||
|
||||
|
||||
class ApiBase(object):
|
||||
""" Base class for all API objects """
|
||||
|
@ -27,6 +32,11 @@ class ApiBase(object):
|
|||
except AttributeError:
|
||||
return obj
|
||||
|
||||
@staticmethod
|
||||
def _quote_url(string):
|
||||
""" Make a string suitable for insertion into a URL """
|
||||
return quote(string.encode('utf-8'))
|
||||
|
||||
@staticmethod
|
||||
def _result_to_list(result):
|
||||
""" Handle the case where the result contains no items """
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue