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):
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.
POST_ACTIONS = [
# Status Methods
- 'update', 'retweet', 'update_with_media',
+ 'update', 'retweet', 'update_with_media', 'statuses/lookup',
# Direct Message Methods
'new',
'create', 'create_all',
# Users Methods
- 'lookup', 'report_spam',
+ 'users/lookup', 'report_spam',
# Streaming Methods
'filter', 'user', 'site',