]> jfr.im git - z_archive/twitter.git/blobdiff - twitter/api.py
Do not POST to friendships/lookup, only users/lookup and statuses/lookup
[z_archive/twitter.git] / twitter / api.py
index 2cdde6fb0661d894dbb3ecce825d052ba44be5b7..715e91d35314a1ddc2d24f9648571d3a49417c70 100644 (file)
@@ -128,6 +128,13 @@ def wrap_response(response, headers):
         res = response
     return res
 
+def method_for_uri(uri):
+    method = "GET"
+    for action in POST_ACTIONS:
+        if re.search("%s(/\d+)?$" % action, uri):
+            method = "POST"
+            break
+    return method
 
 class TwitterCall(object):
 
@@ -168,13 +175,7 @@ class TwitterCall(object):
             uriparts.append(str(kwargs.pop(uripart, uripart)))
         uri = '/'.join(uriparts)
 
-        method = kwargs.pop('_method', None)
-        if not method:
-            method = "GET"
-            for action in POST_ACTIONS:
-                if re.search("%s(/\d+)?$" % action, uri):
-                    method = "POST"
-                    break
+        method = kwargs.pop('_method', None) or method_for_uri(uri)
 
         # If an id kwarg is present and there is no id to fill in in
         # the list of uriparts, assume the id goes at the end.