diff --git a/buffpy/api.py b/buffpy/api.py index 92e755e..cca7a28 100644 --- a/buffpy/api.py +++ b/buffpy/api.py @@ -54,6 +54,11 @@ def post(self, url, parser=None, **params): headers = {'Content-Type': 'application/x-www-form-urlencoded'} + #Check if posting data and if data is unicode, encoding it as utf-8 + if 'data' in params and isinstance(params['data'], unicode): + params['data'] = params['data'].encode('utf-8') + + response = self.session.post(url=BASE_URL % url, headers=headers, **params) return parser(response.content)