Commit 40e82fdb authored by Josh Roesslein's avatar Josh Roesslein
Browse files

Added rest of search API trending methods.

parent a00f378d
......@@ -13,6 +13,8 @@ during upgrade will be listed here.
+ added new() method. shortcut for setting up new API instances
example: API.new(auth='basic', username='testuser', password='testpass')
+ update_profile_image() and update_profile_background_image() method added.
+ Added search API methods:
trends, trends_current, trends_daily, and trends_weekly
+ Streaming:
+ Update to new streaming API methods
+ New StreamListener class replacing callback function
......@@ -21,3 +23,5 @@ during upgrade will be listed here.
when user is not followed.
+ python 2.5 import syntax error fixed
+ python 2.5 timeout support for streaming API
+ Changed indents from 2 to 4 spaces
......@@ -30,7 +30,8 @@ Souce code:
Gitorious: <http://gitorious.org/tweepy>
Github: <http://github.com/joshthecoder/tweepy>
Mailinglist: tweepy@googlegroups.com (questions/feature request/bug reports/anything else)
Bug tracker: http://github.com/joshthecoder/tweepy/issues
Mailing list: tweepy@googlegroups.com
Author: Joshua Roesslein
License: MIT
......
......@@ -3,7 +3,7 @@ The plan of attack for the next version of Tweepy.
1.0 -> 1.0.1
============
+ changing profile and background images [DONE]
+ finish search api
+ finish search api [DONE]
+ autodetect authenticated user's ID [DONE]
+ make oauth handler more web app friendly
+ address file locking portability issues in file cache
......
......@@ -425,9 +425,33 @@ class API(object):
return bind_api(
host = 'search.' + self.host,
path = '/trends.json',
parser = parse_trend_results
parser = parse_json
)(self)
def trends_current(self, *args, **kargs):
return bind_api(
host = 'search.' + self.host,
path = '/trends/current.json',
parser = parse_json,
allowed_param = ['exclude']
)(self, *args, **kargs)
def trends_daily(self, *args, **kargs):
return bind_api(
host = "search." + self.host,
path = '/trends/daily.json',
parser = parse_json,
allowed_param = ['date', 'exclude']
)(self, *args, **kargs)
def trends_weekly(self, *args, **kargs):
return bind_api(
host = "search." + self.host,
path = '/trends/weekly.json',
parser = parse_json,
allowed_param = ['date', 'exclude']
)(self, *args, **kargs)
def _pack_image(filename, max_size):
"""Pack image from file into multipart-formdata post body"""
# image must be less than 700kb in size
......
......@@ -91,7 +91,9 @@ def _parse_status(obj, api):
status._api = api
for k, v in obj.items():
if k == 'user':
setattr(status, 'author', _parse_user(v, api))
user = _parse_user(v, api)
setattr(status, 'author', user)
setattr(status, 'user', user) # DEPRECIATED
elif k == 'created_at':
setattr(status, k, _parse_datetime(v))
elif k == 'source':
......@@ -204,8 +206,3 @@ def parse_search_results(data, api):
result_objects.append(_parse_search_result(obj, api))
return result_objects
def parse_trend_results(data, api):
return json.loads(data)['trends']
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