Skip to content

Commit

Permalink
Merge pull request #50 from tg123/json_body
Browse files Browse the repository at this point in the history
fix \u in message
  • Loading branch information
whtsky committed Apr 13, 2014
2 parents a9caba1 + ca2e55a commit 16f8dee
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions werobot/client.py
Expand Up @@ -4,7 +4,7 @@
import requests


from requests.compat import json
from requests.compat import json as _json
from werobot.utils import to_text


Expand Down Expand Up @@ -37,7 +37,10 @@ def request(self, method, url, **kwargs):
if "params" not in kwargs:
kwargs["params"] = {"access_token": self.token}
if isinstance(kwargs.get("data", ""), dict):
kwargs["data"] = json.dumps(kwargs["data"])
body = _json.dumps(kwargs["data"], ensure_ascii=False)
body = body.encode('utf8')
kwargs["data"] = body

r = requests.request(
method=method,
url=url,
Expand Down

0 comments on commit 16f8dee

Please sign in to comment.