Skip to content

Commit

Permalink
fix unicode string compability issue in python3. use 'str' instead of…
Browse files Browse the repository at this point in the history
… 'unicode'
  • Loading branch information
xddotcom committed Nov 7, 2016
1 parent e6616b6 commit 66e214a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion weixin/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def handle_data(self, data):


def error_parser(error_html, encoding='gbk'):
html = unicode(error_html, encoding or 'gbk')
html = text_type(error_html, encoding or 'gbk')
error_parser = WeixiErrorParser()
error_parser.feed(html)
if error_parser.data:
Expand Down
4 changes: 2 additions & 2 deletions weixin/oauth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@


from .json_import import simplejson
from .helper import error_parser, get_encoding, url_encode, iteritems
from .helper import error_parser, get_encoding, url_encode, iteritems, text_type


TIMEOUT = 2
Expand Down Expand Up @@ -146,7 +146,7 @@ def _data_for_exchange(self, code=None, js_code=None,
app_params.update(scope=' '.join(scope))
str_app_parmas = {}
for k, v in iteritems(app_params):
str_app_parmas[k] = unicode(v).encode('utf-8')
str_app_parmas[k] = text_type(v).encode('utf-8')
url_params = urlencode(str_app_parmas)
if code:
return "%s?%s" % (self.api.access_token_url, url_params)
Expand Down

0 comments on commit 66e214a

Please sign in to comment.