Make all the scripts executable.
[iron-blogger] / report.py
old mode 100644 (file)
new mode 100755 (executable)
index 3959889..998a1cc
--- a/report.py
+++ b/report.py
@@ -1,3 +1,4 @@
+#!/usr/bin/python
 import yaml
 import feedparser
 import datetime
@@ -20,9 +21,15 @@ def get_date(post):
     return post.updated
 
 def get_link(post):
+    if 'links' in post:
+        links = dict((l.rel, l) for l in post.links if 'html' in l.type)
+        if 'self' in links:
+            return links['self'].href
+        elif 'alternate' in links:
+            return links['alternate'].href
     if 'href' in post:
         return post.href
-    return post.links[0]['href']
+    return None
 
 def parse_feeds(weeks, uri):
     feed = feedparser.parse(uri)
@@ -49,5 +56,5 @@ for (username, u) in users.items():
     for (i, w) in enumerate(weeks):
         print " [%d]: %s" % (i, w)
 
-with open('report.yml', 'w') as f:
+with open('out/report.yml', 'w') as f:
     yaml.safe_dump(log, f)

Benjamin Mako Hill || Want to submit a patch?