Commit 0bd6d578 authored by Thomas Whitton's avatar Thomas Whitton
Browse files

Added suggest user api methods

parent 93f0a76c
......@@ -95,6 +95,15 @@ class TweepyAPITests(unittest.TestCase):
def testsearchusers(self):
self.api.search_users('twitter')
def testsuggestedusers(self):
self.api.suggested_users('twitter')
def testsuggestedcategories(self):
self.api.suggested_categories()
def testsuggestedhuserstweets(self):
self.api.suggested_users_tweets('twitter')
def testme(self):
me = self.api.me()
self.assertEqual(me.screen_name, username)
......
......@@ -9,7 +9,7 @@ __version__ = '1.12'
__author__ = 'Joshua Roesslein'
__license__ = 'MIT'
from tweepy.models import Status, User, DirectMessage, Friendship, SavedSearch, SearchResult, ModelFactory
from tweepy.models import Status, User, DirectMessage, Friendship, SavedSearch, SearchResult, ModelFactory, Category
from tweepy.error import TweepError
from tweepy.api import API
from tweepy.cache import Cache, MemoryCache, FileCache
......
......@@ -198,6 +198,30 @@ class API(object):
allowed_param = ['q', 'per_page', 'page']
)
""" users/suggestions/:slug """
suggested_users = bind_api(
path = '/users/suggestions/{slug}.json',
payload_type = 'user', payload_list = True,
require_auth = True,
allowed_param = ['slug', 'lang']
)
""" users/suggestions """
suggested_categories = bind_api(
path = '/users/suggestions.json',
payload_type = 'category', payload_list = True,
allowed_param = ['lang'],
require_auth = True
)
""" users/suggestions/:slug/members """
suggested_users_tweets = bind_api(
path = '/users/suggestions/{slug}/members.json',
payload_type = 'status', payload_list = True,
allowed_param = ['slug'],
require_auth = True
)
""" statuses/friends """
friends = bind_api(
path = '/statuses/friends.json',
......
......@@ -183,6 +183,16 @@ class Friendship(Model):
return source, target
class Category(Model):
@classmethod
def parse(cls, api, json):
category = cls(api)
for k, v in json.items():
setattr(category, k, v)
return category
class SavedSearch(Model):
@classmethod
......@@ -338,9 +348,9 @@ class BoundingBox(Model):
def origin(self):
"""
Return longitude, latitude of southwest (bottom, left) corner of
bounding box, as a tuple.
Return longitude, latitude of southwest (bottom, left) corner of
bounding box, as a tuple.
This assumes that bounding box is always a rectangle, which
appears to be the case at present.
"""
......@@ -349,8 +359,8 @@ class BoundingBox(Model):
def corner(self):
"""
Return longitude, latitude of northeast (top, right) corner of
bounding box, as a tuple.
bounding box, as a tuple.
This assumes that bounding box is always a rectangle, which
appears to be the case at present.
"""
......@@ -403,6 +413,7 @@ class ModelFactory(object):
friendship = Friendship
saved_search = SavedSearch
search_result = SearchResult
category = Category
list = List
relation = Relation
relationship = Relationship
......
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