Beispiel #1
0
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")
Beispiel #2
0
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")
Beispiel #3
0
			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")
Beispiel #4
0
            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")