Commit 8951f603 authored by Josh Roesslein's avatar Josh Roesslein
Browse files

Added user followers/friends methods. Added update/destroy status.

parent 13570f58
......@@ -73,4 +73,26 @@ class API(object):
require_auth = True
)
"""Show user"""
get_user = bind_api(
path = '/users/show.json',
parser = parse_user,
allowed_param = ['id', 'user_id', 'screen_name']
)
"""Show friends"""
friends = bind_api(
path = '/statuses/friends.json',
parser = parse_users,
allowed_param = ['id', 'user_id', 'screen_name', 'page']
)
"""Show followers"""
followers = bind_api(
path = '/statuses/followers.json',
parser = parse_users,
allowed_param = ['id', 'user_id', 'screen_name', 'page'],
require_auth = True
)
api = API('jitterapp', 'josh1987')
......@@ -17,9 +17,18 @@ def _parse_user(obj, classes):
user = classes['user']()
for k,v in obj.items():
setattr(user, k, v)
if k == 'created_at':
setattr(user, k, _parse_datetime(v))
elif k == 'status':
setattr(user, k, _parse_status(v, classes))
else:
setattr(user, k, v)
return user
def parse_user(data, classes):
return _parse_user(json.loads(data), classes)
def parse_users(data, classes):
users = []
......
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