Commits

droodle  committed 288c931

some more error handling

  • Participants
  • Parent commits 9772ac4

Comments (0)

Files changed (2)

File podcaster/lib/podcast.py

 # -*- coding:utf-8 -*-
 import collections
-from webob.exc import HTTPOk, HTTPClientError, HTTPTemporaryRedirect
+from webob.exc import HTTPOk, HTTPClientError, HTTPTemporaryRedirect, HTTPNotFound
 from nagare import editor, validator, presentation
 from podcaster.lib.dates import rfc2822
 from podcaster.lib.renderers import RssRenderer, ItunesRenderer
     name = url[1]
     format = self.choose_format(url[2] if len(url) >= 3 else None)
     feed = self.get_user_feed(name)
+    if feed is None:
+        raise HTTPNotFound()
     r = RssRenderer()
     r.namespaces = {'itunes': 'http://www.itunes.com/dtds/podcast-1.0.dtd'}
     i = ItunesRenderer(r)

File podcaster/platforms/dailymotion/comp.py

 
     def get_user_feed(self, username, max_results=25):
         ress = restkit.Resource("https://api.dailymotion.com")
-        resp = ress.get("/videos", user=username, fields='id,title,created_time,modified_time,duration').body_string()
+        try:
+            resp = ress.get("/videos", user=username, fields='id,title,created_time,modified_time,duration').body_string()
+        except restkit.errors.RequestFailed:
+            # Not found
+            return None
         data = json.loads(resp)
 
         videos = []