def scraping(): mars_info = mongo.db.mars_info #scrape_news() #scrape_image() #scrape_tweets() #scrape_facts() #scrape_hemispheres() news = scrape_mars.scrape_news() image = scrape_mars.scrape_image() tweets = scrape_mars.scrape_tweets() facts = scrape_mars.scrape_facts() hemispheres = scrape_mars.scrape_hemispheres() update_data = { 'news': news, 'image': image, 'tweets': tweets, 'facts': facts, 'hemispheres': hemispheres } # listings.update({}, listings_data, upsert=True) mars_info.update({}, update_data, upsert=True) return redirect("/", code=302)
def scraper(): mars_data = mongo.db.mars_data mars_info = scrape_mars.scrape_news() mars_info = scrape_mars.scrape_image() mars_info = scrape_mars.scrape_weather() mars_info = scrape_mars.scrape_facts() mars_info = scrape_mars.scrape_hemispheres() mars_data.update({}, mars_info, upsert=True) return redirect("/", code=302)
def scrape(): mars_data = mongo.db.mars mars_data = scrape_mars.scrape() mars_data = scrape_mars.scrape_featured() mars_data = scrape_mars.scrape_facts() mars_data = scrape_mars.scrape_wx() mars_data = scrape_mars.scrape_hemispheres() mongo.db.mars_data.update({}, mars_data, upsert=True) #render_template("index.html", mars=mars_data) return redirect("/", code=302)
def scrape(): mars_db=mongo.db.mars_db mars_data=scrape_mars.scrape_news() mars_data=scrape_mars.scrape_img() mars_data=scrape_mars.scrape_weather() mars_data=scrape_mars.scrape_facts() mars_data=scrape_mars.scrape_hemispheres() mars_db.update({}, mars_data, upsert=True) return redirect("/",code=302)
def scrape(): mars_dict = mongo.db.mars_dict mars_data = scrape_mars.scrape_news() mars_data = scrape_mars.scrape_image() mars_data = scrape_mars.scrape_facts() mars_data = scrape_mars.scrape_hemispheres() # Update the Mongo Database using update and upsert=True mars_dict.update({}, mars_data, upsert=True) # Redirect back to home page return redirect("/", code=302)
def scrape(): all_mars_info = mongo.db.all_mars_info new_data = scrape_mars.scrape_news() new_data = scrape_mars.scrape_image() new_data = scrape_mars.scrape_facts() new_data = scrape_mars.scrape_hemispheres() new_data = scrape_mars.scrape_weather() all_mars_info.update({}, new_data, upsert=True) return redirect("/", code=302)
def home(): feat_img = scrape_mars.scrape_featured() weather = scrape_mars.scrape_weather() hemi = scrape_mars.scrape_hemispheres() #fetch news data from mongodb news_data = mongo.db.collection_news.find() profile, comp = scrape_mars.scrape_facts() return render_template("index.html", feat_img=feat_img, weather=weather, hemi=hemi, news_data=news_data, profile=profile, comp=comp)
def scrape(): # run the news scrape function news_data = scrape_mars.scrape_news() # run the hemisphere scrape function hemisphere_image_urls = scrape_mars.scrape_hemispheres() # update dictionary for hemisphere scrape for i in range(len(hemisphere_image_urls)): news_data.update(hemisphere_image_urls[i]) # run the mars facts scrape function mars_facts = scrape_mars.scrape_facts() # update dictionary for mars facts scrape news_data["mars_facts"] = mars_facts # update the Mongo database using update and upsert=True mongo.db.collection.drop() mongo.db.collection.update({}, news_data, upsert=True) # redirect back to home page return redirect("/")