From: Harmon Date: Sun, 3 Jan 2021 02:10:16 +0000 (-0600) Subject: Replace convert_to_utf8_str function with str cast X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=242d59c3b54516840d260f89fd9495f91321eb72;p=tweepy.git Replace convert_to_utf8_str function with str cast --- diff --git a/tweepy/binder.py b/tweepy/binder.py index 2a7a2fc..a553a2c 100644 --- a/tweepy/binder.py +++ b/tweepy/binder.py @@ -12,7 +12,6 @@ from urllib.parse import quote, urlencode from tweepy.error import is_rate_limit_error_message, RateLimitError, TweepError from tweepy.models import Model -from tweepy.utils import convert_to_utf8_str re_path_template = re.compile(r'{\w+}') @@ -92,7 +91,7 @@ def bind_api(**config): if arg is None: continue try: - self.session.params[self.allowed_param[idx]] = convert_to_utf8_str(arg) + self.session.params[self.allowed_param[idx]] = str(arg) except IndexError: raise TweepError('Too many parameters supplied!') @@ -102,7 +101,7 @@ def bind_api(**config): if k in self.session.params: raise TweepError('Multiple values for parameter %s supplied!' % k) - self.session.params[k] = convert_to_utf8_str(arg) + self.session.params[k] = str(arg) log.debug("PARAMS: %r", self.session.params) diff --git a/tweepy/utils.py b/tweepy/utils.py index b1a2515..793cf98 100644 --- a/tweepy/utils.py +++ b/tweepy/utils.py @@ -13,15 +13,6 @@ def parse_a_href(atag): return atag[start:end] -def convert_to_utf8_str(arg): - # written by Michael Norton (http://docondev.blogspot.com/) - if isinstance(arg, str): - arg = arg.encode('utf-8') - elif not isinstance(arg, bytes): - arg = str(arg).encode('utf-8') - return arg - - def list_to_csv(item_list): if item_list: return ','.join(map(str, item_list))