def retrieve_subs(): is_cache = False db = store.get_db() try: rss = db.exists('subrss/user/%s/rss' % session['username']) if rss: if db.exists('subrss/users/%s/json_cache_time' % session['username']): last_time = int(db.get('subrss/users/%s/json_cache_time' % session['username'])) if last_time + 3600 >= _rss.to_unix_timestamp(datetime.now()): rss_items = json.loads(db.get('subrss/users/%s/json_cache' % session['username'])) is_cache = True rss_lastcheck = datetime.now() rss_error = False if not is_cache: (rss_url, rss_lastcheck, rss_items) = _rss.get_rss(session['username']) rss_error = True if not rss_url and not rss_lastcheck and not rss_items else False else: (rss_url, rss_lastcheck, rss_items) = (None, False, []) rss_error = True except Exception, e: return str(e) rss_error = True rss_lastcheck = None rss_items = None
def get_rss(self, languageId, timespanId): rss_feed = rss.get_rss(github.languages[languageId], github.timespans[timespanId], github.get_projects(languageId, timespanId)) return rss_feed
#!/usr/bin/python import rss import github print rss.get_rss('c', 'C', 'weekly', github.get_projects('csharp', 'weekly'))
def get_feed(): feed = rss.get_rss() return Response(feed, mimetype='text/xml')