Skip to content

Commit

Permalink
Add exception handling for feed urls.
Browse files Browse the repository at this point in the history
Handles errors such as: Invalid URL '': No schema supplied. Perhaps you
meant http://?

Also updates .gitignore to ignore build dir.
  • Loading branch information
ruebot committed Jan 15, 2017
1 parent 98d88c2 commit f72e895
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -8,3 +8,4 @@ diffs/*
.eggs
test
diffengine.egg-info
build
31 changes: 17 additions & 14 deletions diffengine/__init__.py
Expand Up @@ -431,20 +431,23 @@ def main():
start_time = datetime.utcnow()
logging.info("starting up with home=%s", home)

for f in config.get('feeds', []):

feed, created = Feed.create_or_get(url=f['url'], name=f['name'])
if created:
logging.debug("created new feed for %s", f['url'])

# get latest feed entries
feed.get_latest()

# get latest content for each entry
for entry in feed.entries:
version = entry.get_latest()
if version and version.diff and 'twitter' in f:
tweet_diff(version.diff, f['twitter'])
try:
for f in config.get('feeds', []):

feed, created = Feed.create_or_get(url=f['url'], name=f['name'])
if created:
logging.debug("created new feed for %s", f['url'])

# get latest feed entries
feed.get_latest()

# get latest content for each entry
for entry in feed.entries:
version = entry.get_latest()
if version and version.diff and 'twitter' in f:
tweet_diff(version.diff, f['twitter'])
except Exception as e:
logging.error("unable to access: %s due to %s", f['url'], e)

logging.info("shutting down: %s", (datetime.utcnow() - start_time))

Expand Down

0 comments on commit f72e895

Please sign in to comment.