Skip to content

Commit b4dc7dd

Browse files
committed
Fixed an error with twitter
1 parent a8400ca commit b4dc7dd

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

example/tweet.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ def tweet():
113113
})
114114
if resp.status == 403:
115115
flash('Your tweet was too long.')
116+
elif resp.status == 401:
117+
flash('Authorization error with Twitter.')
116118
else:
117119
flash('Successfully tweeted your tweet (ID: #%s)' % resp.data['id'])
118120
return redirect(url_for('index'))

flaskext/oauth.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ def encode_request_data(data, format):
6363
if format is None:
6464
return data, None
6565
elif format == 'json':
66-
return json.dumps(data), 'application/json'
66+
return json.dumps(data or {}), 'application/json'
6767
elif format == 'urlencoded':
68-
return url_encode(data), 'application/x-www-form-urlencoded'
68+
return url_encode(data or {}), 'application/x-www-form-urlencoded'
6969
raise TypeError('Unknown format %r' % format)
7070

7171

@@ -234,7 +234,6 @@ def request(self, url, data=None, headers=None, format='urlencoded',
234234
data, content_type = encode_request_data(data, format)
235235
if content_type is not None:
236236
headers['Content-Type'] = content_type
237-
headers['Content-Length'] = str(len(data))
238237
return OAuthResponse(*client.request(url, method=method,
239238
body=data, headers=headers))
240239

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
setup(
1818
name='Flask-OAuth',
19-
version='0.9',
19+
version='0.9.1',
2020
url='http://github.com/mitsuhiko/flask-oauth',
2121
license='BSD',
2222
author='Armin Ronacher',

0 commit comments

Comments
 (0)