Permalink
Browse files

* Fix Github commit feed parsing.

  • Loading branch information...
1 parent f729617 commit d4ac466ac7eaa045b1bfa63d658ee0424b4974da Danny Allen committed Nov 14, 2014
Showing with 16 additions and 11 deletions.
  1. +16 −11 enzymeproject/feed.py
View
@@ -37,14 +37,19 @@ def get_commits_feed(feed_url, limit=None):
# iterate and process into usable data structure
commits = []
for entry in entries:
- commits.append({
- "date": parse_date(entry.find("{http://www.w3.org/2005/Atom}updated").text),
- "author": {
- "name": entry.find(".//{http://www.w3.org/2005/Atom}author/{http://www.w3.org/2005/Atom}name").text,
- "url": entry.find(".//{http://www.w3.org/2005/Atom}author/{http://www.w3.org/2005/Atom}uri").text,
- },
- "url": entry.find("{http://www.w3.org/2005/Atom}link").attrib["href"],
- "message": entry.find("{http://www.w3.org/2005/Atom}title").text,
- })
-
- return commits
+ try:
+ commits.append({
+ "date": parse_date(entry.find("{http://www.w3.org/2005/Atom}updated").text),
+ "author": {
+ "name": entry.find(".//{http://www.w3.org/2005/Atom}author/{http://www.w3.org/2005/Atom}name").text,
+ "url": entry.find(".//{http://www.w3.org/2005/Atom}author/{http://www.w3.org/2005/Atom}uri").text,
+ },
+ "url": entry.find("{http://www.w3.org/2005/Atom}link").attrib["href"],
+ "message": entry.find("{http://www.w3.org/2005/Atom}title").text,
+ })
+
+ except AttributeError:
+ # if the commit item does not have an attribute, ignore it
+ pass
+
+ return commits

0 comments on commit d4ac466

Please sign in to comment.