__author__ = 'idclark'
import requests as r


def about_subreddit(sr):
    """get an overview for a given subreddit"""

    url = r'http://www.reddit.com/r/{sr}/about.json'.format(sr=sr)
    response = r.get(url)
    return response.content


def my_subreddits(status, limit):
    """
    return a list of subreddits for your account.
     status: 'subscriber', 'moderator', 'contributor'
     limit: max of 100
    """
    url = r'http://www.reddit.com/subreddits/mine/{st}.json'.format(st=status)
    data = {'limit': limit}
    response = r.get(url, data=data)
    return response.content


@@ -226,23 +226,22 @@
 esponse.
-content
+json()
 %0A%0A%0Adef m
@@ -580,13 +580,985 @@
 nse.
-content
+json()%0A%0A%0A#this returns 404 ??TODO%0Adef recommend_subreddits(srnames, omit):%0A    %22%22%22%0A    Inputs: srnames = comma sep list of subreddits%0A    omit: subreddits to ommit from the reccommendation%0A    %22%22%22%0A    data = %7B'srnames': list(srnames), 'omit': list(omit)%7D%0A    url = r'http://www.reddit.com/api/subreddit_recommendations'%0A    response = r.get(url, data=data)%0A    return response.content%0A%0A#TODO this returns an empty list...%0Adef search_by_topic(query):%0A    %22%22%22%0A    search subreddits by inputting a given topic%0A    %22%22%22%0A    data = %7B'query': str(query)%7D%0A    url = r'http://www.reddit.com/api/subreddits_by_topic.json'%0A    response = r.get(url, data=data)%0A    return response.json()%0A%0A%0Adef subreddit_by_rank(criteria, limit):%0A    %22%22%22%0A    returns list of subreddits according to given criteria%0A     popular, new, banned%0A    %22%22%22%0A    data = %7B'limit': limit%7D%0A    url = r'http://www.reddit.com/subreddits/%7Bc%7D.json'.format(c=criteria)%0A    response = r.get(url, data)%0A    return response.json()
 %0A%0A

add functions to subreddit module