def dashboard(self, start=0, num=20, type=None, likes=0): """ Dashboard reading. Arguments: - `start`: The post offset to start from. The default is 0. - `num`: The number of posts to return. The default is 20, and the maximum is 50. - `type`: The type of posts to return. If unspecified or empty, all types of posts are returned. Must be one of text, quote, photo, link, chat, video, or audio. - `likes`: (optional) 1 or 0, default 0. If 1, liked posts will have the liked="true" attribute. """ url = "http://www.tumblr.com/api/dashboard/json" query = dict(email=self._email, password=self._password, start=start, num=num, likes=likes, type=type) return ApiRead.parse(self._read_json_data(url, utils.urlencode(query)))
def read(self, name, start=0, num=20, type=None, id=None, search=None, tagged=None): """ Reading Tumblr data. Arguments: - `name`: username - `start`: The post offset to start from. The default is 0. - `num`: The number of posts to return. The default is 20, and the maximum is 50. - `type`: (optional) The type of posts to return. If unspecified or empty, all types of posts are returned. Must be one of text, quote, photo, link, chat, video, or audio. - `id`: A specific post ID to return. Use instead of start, num, or type. - `search`: Search for posts with this query. - `tagged`: Return posts with this tag in reverse-chronological order (newest first). """ if id is not None: query = dict(id=id) else: query = dict(start=start, num=num, type=type, search=search, tagged=tagged) url = "http://%s/api/read/json?%s" % ((name if "." in name else "%s.tumblr.com" % name), utils.urlencode(query)) # url = "http://%s.tumblr.com/api/read/json?%s" % (name, utils.urlencode(query)) return ApiRead.parse(self._read_json_data(url))