def cbc(): if 'url' in request.args: url = request.args['url'] cbcRss = getCbcRss() if url not in cbcRss: return jsonify(items="Requested category doesnt exist") else: directory = "./data/cbc/" fileName = url + ".json" with open(directory + fileName) as f: s = json.load(f) return jsonify(items=s) else: return jsonify(items="Feed category not defined")
destination = directory + key + ".json" if os.path.exists(source): copyfile(source, destination) print('copied file: %s' % destination) else: print ('cannot copy file: source %s not found' % source) print("--- %s seconds ---\n" % (time.time() - startTime)) #iteration runtime except Exception: print("EXCEPTION ERROR EXCEPTION ERROR!!") pass searchedImages = {} # variable for caching google image urls counter = 1 # count the iterations of while loop bbcRssDict = rss_sources.getBbcRss() cbcRssDict = rss_sources.getCbcRss() reutersRssDict = rss_sources.getReutersRss() while True: getNews(bbcRssDict, 'bbc', searchedImages) print("SERVICE BBC COMPLETE!") time.sleep(300) print("sleeping for 5 minutes to calm down Google") getNews(cbcRssDict, 'cbc', searchedImages) print("SERVICE CBC COMPLETE!") time.sleep(300) print("sleeping for 5 minutes to calm down Google")
if os.path.exists(source): copyfile(source, destination) print('copied file: %s' % destination) else: print('cannot copy file: source %s not found' % source) print("--- %s seconds ---\n" % (time.time() - startTime)) #iteration runtime except Exception: print("EXCEPTION ERROR EXCEPTION ERROR!!") pass searchedImages = {} # variable for caching google image urls counter = 1 # count the iterations of while loop bbcRssDict = rss_sources.getBbcRss() cbcRssDict = rss_sources.getCbcRss() reutersRssDict = rss_sources.getReutersRss() while True: getNews(bbcRssDict, 'bbc', searchedImages) print("SERVICE BBC COMPLETE!") time.sleep(300) print("sleeping for 5 minutes to calm down Google") getNews(cbcRssDict, 'cbc', searchedImages) print("SERVICE CBC COMPLETE!") time.sleep(300) print("sleeping for 5 minutes to calm down Google")