From db1cdda40b16d013454c721134c061fb2ac6b7d8 Mon Sep 17 00:00:00 2001 From: Anna Date: Wed, 7 Apr 2010 12:54:40 -0400 Subject: [PATCH] Added readme and necessary patch for python-twitter --- README | 24 ++++++++++++++++ python-twitter-GetListStatuses.patch | 43 ++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 README create mode 100644 python-twitter-GetListStatuses.patch diff --git a/README b/README new file mode 100644 index 0000000..f21e611 --- /dev/null +++ b/README @@ -0,0 +1,24 @@ +mytwitter is a simple python twitter application. I wrote it for two reasons: + +1. No existing twitter app supports the Lists API + +2. An excuse to learn Python + + +While I doubt it will be terribly useful for anyone other than me, feel free to take it for a spin and let me know how it goes. You'll need the following: + +* PMW (Python mega-widgets) +* TKinter +* The latest dev version of python-twitter, along with my patch (included here) + + +For python-twitter, you can download and install it with: + +hg clone https://python-twitter.googlecode.com/hg/ python-twitter +cd python-twitter +hg update dev +hg patch -u "Patrick Wiggins " ../mytwitter/python-twitter-GetListStatuses.patch +python build.py build +python build.py install --user + +This will install python-twitter in your ~/.local/lib directory, which python 2.6 will automatically include in PYTHONPATH. diff --git a/python-twitter-GetListStatuses.patch b/python-twitter-GetListStatuses.patch new file mode 100644 index 0000000..1968054 --- /dev/null +++ b/python-twitter-GetListStatuses.patch @@ -0,0 +1,43 @@ +diff -r 51ac454d5d89 twitter.py +--- a/twitter.py Thu Dec 31 15:06:42 2009 -0500 ++++ b/twitter.py Tue Apr 06 15:05:55 2010 -0400 +@@ -380,6 +380,7 @@ + >>> api.GetUserLists(user, cursor) + >>> api.GetListMembers(list_slug, user, cursor) + >>> api.GetList(list_slug, user) ++ >>> api.GetListStatuses(list_slug, user) + + Example usage of lists: + +@@ -1117,6 +1118,31 @@ + self._CheckForTwitterError(data) + return NewListFromJsonDict(data) + ++ def GetListStatuses(self, list_slug, user=None): ++ '''Fetch the List statuses for a given user / list. ++ ++ Args: ++ list_slug: slug of the list to fetch ++ user: the username or id of the user whose friends you are fetching. If ++ not specified, defaults to the authenticated user. [optional] ++ ++ The twitter.Api instance must be authenticated. ++ ++ Returns: ++ The list information. ++ ''' ++ if not user and not self._username: ++ raise TwitterError("User must be specified if API is not authenticated.") ++ if user: ++ url = 'http://twitter.com/%s/lists/%s/statuses.json' % (user,list_slug) ++ else: ++ url = 'http://twitter.com/%s/lists/%s/statuses.json' % (self._username,list_slug) ++ parameters = {} ++ json = self._FetchUrl(url, parameters=parameters) ++ data = simplejson.loads(json) ++ self._CheckForTwitterError(data) ++ return [NewStatusFromJsonDict(x) for x in data] ++ + def Search(self, + query, + lang=None,