]> jfr.im git - z_archive/twitter.git/commitdiff
Update oauth_dance.py
authorPhilipp Omenitsch <redacted>
Thu, 29 Jan 2015 15:53:35 +0000 (16:53 +0100)
committerPhilipp Omenitsch <redacted>
Thu, 29 Jan 2015 15:53:35 +0000 (16:53 +0100)
Fixed bug for python 3.4 in oauth2_dance where response was encoded
(this works in python 2.7 because json.loads can decode bytes, but in 3.4 json.loads takes only strings!)

twitter/oauth_dance.py

index 1d005a86a7f257189905147e4a4241fed88ba99c..43b88d0ea6e01a46c793408102e845094ed8e58f 100644 (file)
@@ -25,8 +25,7 @@ def oauth2_dance(consumer_key, consumer_secret, token_filename=None):
         auth=OAuth2(consumer_key=consumer_key, consumer_secret=consumer_secret),
         format="",
         api_version="")
-    token = json.loads(twitter.oauth2.token(grant_type="client_credentials")
-        .encode("utf8"))["access_token"]
+    token = json.loads(twitter.oauth2.token(grant_type="client_credentials"))["access_token"]
     if token_filename:
         write_bearer_token_file(token)
     return token