Browse files

need to check if list exists before creating it

  • Loading branch information...
1 parent 2a42c70 commit 6dad40bfe1ae77ceddaf588ba3c37728131c704f @edsu committed Feb 18, 2010
Showing with 28 additions and 10 deletions.
  1. +15 −7 planet/planet.ini
  2. +13 −3 twitter_list.py
View
22 planet/planet.ini
@@ -83,6 +83,14 @@ name = Daniel Hagon (My Electric Me feed)
name = Paul Miller (Paul Miller RSS Feed)
+[http://www.peetm.com/blog/?feed=rss2]
+name = Peet Morris (RSS 2.0)
+
+
+[http://www.peetm.com/blog/?feed=atom]
+name = Peet Morris (Atom 0.3)
+
+
[http://wwmm.ch.cam.ac.uk/blogs/murrayrust/?feed=rss2]
name = Peter Murray-rust (petermr’s blog RSS Feed)
@@ -164,15 +172,15 @@ name = Caroline Johnston (Back of a Stamp Atom Feed)
[http://oxfordrepo.blogspot.com/feeds/posts/default]
-name = Benjamin O'steen (Less Talk, More Code - Atom)
+name = Benjamin O'Steen (Less Talk, More Code - Atom)
[http://oxfordrepo.blogspot.com/feeds/posts/default?alt=rss]
-name = Benjamin O'steen (Less Talk, More Code - RSS)
+name = Benjamin O'Steen (Less Talk, More Code - RSS)
[http://benosteen.tumblr.com/rss]
-name = Benjamin O'steen (RSS)
+name = Benjamin O'Steen (RSS)
[http://digitisation.jiscinvolve.org/feed/]
@@ -187,6 +195,10 @@ name = Ben Showers (Atom 0.3)
name = Ross McFarlane (RSS)
+[http://benosteen.wordpress.com/feed/]
+name = Benjamin O'Steen (Random Hacks RSS Feed)
+
+
[http://ukwebfocus.wordpress.com/feed/]
name = Brian Kelly (UK Web Focus RSS Feed)
@@ -271,10 +283,6 @@ name = Spiros Denaxas (/home/idaru - Atom)
name = Spiros Denaxas (/home/idaru - RSS)
-[http://johngoodwin225.wordpress.com/feed/]
-name = John Goodwin (John’s Weblog RSS Feed)
-
-
[http://www.rkbexplorer.com/blog/?feed=rss2]
name = Hugh Glaser (RKB Blog » Feed)
View
16 twitter_list.py
@@ -58,9 +58,19 @@ def update_list():
g.close()
def create_list(username, list_name, client):
- list_create_url = 'http://api.twitter.com/1/%s/lists.json' % username
- body = "name=%s" % list_name
- resp, content = client.request(list_create_url, 'POST', body=body)
+ list_url = 'http://api.twitter.com/1/%s/lists.json' % username
+ resp, content = client.request(list_url)
+ json = simplejson.loads(content)
+
+ list_exists = False
+ for list in json['lists']:
+ if list['name'] == list_name:
+ list_exists = True
+
+ if not list_exists:
+ logging.info("creating list %s" % list_name)
+ body = "name=%s" % list_name
+ resp, content = client.request(list_url, 'POST', body=body)
def twitter_user_id(username, client):
"""

0 comments on commit 6dad40b

Please sign in to comment.