Commit dc4f9240 authored by Josh Roesslein's avatar Josh Roesslein
Browse files

Added statuses/retweets method. Implemented retweets parser. Added retweet model.

parent 5b8d9bfb
......@@ -5,8 +5,10 @@ during upgrade will be listed here.
=======================
+ Fixes
+ Google App Engine fixes (thanks Thomas Bohmbach, Jr)
+ Added Retweet API methods
+ Added Retweet Streaming method
+ API
+ Added Retweet API methods
+ Added Retweet Streaming method
+ New model: Retweet
+ OAuthHandler
+ Added set_request_token() method
+ Added support for "sign in with twitter".
......
......@@ -4,6 +4,6 @@ The plan of attack for the next version of Tweepy.
============
+ implement win32 file locking for FileCache
+ add retweet API methods [DONE]
+ add statuses/retweets method
+ add statuses/retweets method [DONE]
+ add retweet streaming method [DONE]
......@@ -133,6 +133,15 @@ class API(object):
require_auth = True
)
"""Get the retweets of the specified tweet ID"""
def retweets(self, id, *args, **kargs):
return bind_api(
path = '/statuses/retweets/%s.json' % id,
parser = parse_retweets,
allowed_param = ['count'],
require_auth = True
)(self, *args, **kargs)
"""Show user"""
get_user = bind_api(
path = '/users/show.json',
......
......@@ -109,6 +109,10 @@ class SearchResult(Model):
pass
class Retweet(Model):
pass
# link up default model implementations.
models = {
'status': Status,
......@@ -116,6 +120,7 @@ models = {
'direct_message': DirectMessage,
'friendship': Friendship,
'saved_search': SavedSearch,
'search_result': SearchResult
'search_result': SearchResult,
'retweet': Retweet,
}
......@@ -212,3 +212,20 @@ def parse_search_results(data, api):
result_objects.append(_parse_search_result(obj, api))
return result_objects
def _parse_retweet(obj, api):
retweet = models['retweet']()
for k,v in obj.items():
if k == 'retweeting_user':
setattr(retweet, k, _parse_user(v, api))
else:
setattr(retweet, k, v)
return retweet
def parse_retweets(data, api):
retweets = []
for obj in json.loads(data):
retweets.append(_parse_retweet(obj, api))
return retweets
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment