]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Make TwitterMixin.twitter_request accept complete urls, not just partial paths.
authorBen Darnell <ben@bendarnell.com>
Wed, 18 Jan 2012 08:57:55 +0000 (00:57 -0800)
committerBen Darnell <ben@bendarnell.com>
Wed, 18 Jan 2012 08:57:55 +0000 (00:57 -0800)
Closes #418.

tornado/auth.py

index 5701bee400bac8da84085b4f4d872e82bd2d0459..a7162105304c546af3e1cdcde4a91a759375b077 100644 (file)
@@ -499,8 +499,13 @@ class TwitterMixin(OAuthMixin):
                     self.finish("Posted a message!")
 
         """
+        if path.startswith('http:') or path.startswith('https:'):
+            # Raw urls are useful for e.g. search which doesn't follow the
+            # usual pattern: http://search.twitter.com/search.json
+            url = path
+        else:
+            url = "http://api.twitter.com/1" + path + ".json"
         # Add the OAuth resource request signature if we have credentials
-        url = "http://api.twitter.com/1" + path + ".json"
         if access_token:
             all_args = {}
             all_args.update(args)