def scrape(): # Run the scrape function and saving results mars_data = scrape_mars.scrape_info() # Updating the mongo database mongo.db.collection.update({}, mars_data, upsert=True) # Redirect back to home page return redirect("/")
def scrape(): # Run the scrape function render_mars = scrape_mars.scrape_info() print(render_mars) # Update the Mongo database using update and upsert=True marsgo.db.collection.update({}, render_mars, upsert=True) # Redirect back to home page return redirect("/")
def scrape(): # Run the scrape function mars_data = scrape_mars.scrape_info() # Update the Mongo database using update and upsert=True mongo.db.mars_app.update({}, mars_data, upsert=True) # Redirect back to home page return redirect("/")
def scrape(): # Run the scrape function mars = mongo.db.mars mars_data = scrape_mars.scrape_info() # Update the Mongo database using update and upsert=True mars.replace_one({}, mars_data, upsert=True) # Redirect back to home page return redirect("/", code=302)
def scrape(): # Run the scrape function and save the results to a variable mars_data = scrape_mars.scrape_info() print(mars_data) # Update the Mongo database using update and upsert=True upsert --> update or insert mongo.db.collection.update({}, mars_data, upsert=True) # Redirect back to home page return redirect("/")
def scrape(): # Run the scrape function mars_info = scrape_mars.scrape_info() #print(mars_info) # Update the Mongo database using update and upsert=True mongo.db.collection.update({}, mars_info, upsert=True) # Redirect back to home page return redirect("/")
def scrape(): # Run the scrape function scraped_mars_data = scrape_mars.scrape_info() # Update the Mongo database using update and upsert=True mongo.db.collection.update({}, scraped_mars_data, upsert=True) # mongo.db.mars.update({}, scraped_mars_data, upsert=True) # Redirect back to home page and return success code return redirect("/", code=302)
def scrape(): # Run the scrape function mars_data = scrape_mars.scrape_info() print(mars_data) # Update the Mongo database using update and upsert=True mongo.db.collection.update({}, mars_data, upsert=True) test_data = mongo.db.collection.find_one() print(test_data) # Redirect back to home page return redirect("/")
def scrape(): # Run the scrape function mars_dataDB = mongo.db.mars_data_collection mars_data = scrape_mars.scrape_info() print(mars_data) # Update the Mongo database using update and upsert=True mars_dataDB.update({}, mars_data, upsert=True) # Redirect back to home page return redirect("/", code = 302)
def scrape(): mars = mongo.db.mars # Run the scrape function mars_data = scrape_mars.scrape_info() # Update the Mongo database using update and upsert=True mars.update({}, mars_data, upsert=True) return redirect('/')
def scrape(): #Make a shortcut to the database marsmission = mongo.db.marsmission # Run the scrape function mars_data = scrape_mars.scrape_info() # Update the Mongo database using update and upsert=True marsmission.update({}, mars_data, upsert=True) # Redirect back to home page return redirect(url_for('home'))
def scrape(): # Run the scrape function data = scrape_mars.scrape_info() db.mars_table.drop() # Update the Mongo database using update and upsert=True db.mars_table.insert_one(data) # Redirect back to home page return redirect("/")
def scrape(): # Run the scrape function mars_dict = scrape_mars.scrape_info() # # Update the Mongo database mongo.db.facts.update({}, mars_dict, upsert=True) print("scrape done") # Redirect back to home page return redirect("/scraped")
def scrape(): # drop any data that is already in database db.mars_data.drop() mars_data = scrape_mars.scrape_info() # Update the Mongo database using update and upsert=True db.mars_data.insert_one(mars_data) # Redirect back to home page return redirect("/")
def scrape(): # Run the scrape function and save the results to a variable mars = mongo.db.mars result_data = scrape_mars.scrape_info() # Update the Mongo database using update and upsert=True mars.update({}, result_data, upsert=True) # Redirect back to home page return redirect("/")
def scrape(): # Run the scrape function nasa_data, mars_data, hemispheres_data = scrape_mars.scrape_info() mongo.db.nasa_details.update({}, nasa_data, upsert=True) mongo.db.mars_details.update({}, mars_data, upsert=True) mongo.db.hemisphere_details.drop() mongo.db.hemisphere_details.insert_many(hemispheres_data) # Redirect back to home page return redirect("/")
def scrape(): #run the scrape function mars_data = scrape_mars.scrape_info() mars = mongo.db.mars mars.replace_one({},mars_data, upsert=True) #Update the Mongo database #mongo.db.mars.update({}, mars_data, upsert = True) #Redirect back to home page #return "Scraping is done!" return redirect("/")
def scrape(): # Run the scrape function final_results = mongo.db.final_results final_results_data = scrape_mars.scrape_info() # Update the Mongo database using update and upsert=True final_results.update({}, final_results_data, upsert=True) # Redirect back to home page return redirect("/", code=302)
def scrape(): mars_info = mongo.db.mars_data mars_data = scrape_mars.scrape_info() # Update the Mongo database using update and upsert=True mars_info.update({}, mars_data, upsert=True) # Redirect back to home page return redirect("/", code=302)
def scrape(): # Find mongo database mars = mongo.db.mars # Run the scrape function mars_data = scrape_mars.scrape_info() # Update the Mongo database using update and upsert=True mars.replace_one({}, mars_data, upsert=True) # Redirect back to home page return 'successful'
def scrape(): # Run the scrape function and save the results to a variable # @TODO: YOUR CODE HERE! page_data = scrape_mars.scrape_info() # Update the Mongo database using update and upsert=True # @TODO: YOUR CODE HERE! mongo.db.collection.update({}, page_data, upsert=True) # Redirect back to home page return redirect("/")
def scrape(): # Run the scrape function mars_data = scrape_mars.scrape_info() # Update the Mongo database using update and upsert=True # mongo.db.collection.update({}, mars_data, upsert=True) mongo.db.collection.drop() mongo.db.collection.insert_one(mars_data) # Redirect back to home page return redirect("/")
def scrape(): mars = mongo.db.mars # Run the scrape function mars_data = scrape_mars.scrape_info() # Worked with t/a to ensure data was was loading into MongoDB properly # Update the Mongo database using update and upsert=True mars.update({}, mars_data, upsert=True) # Redirect back to home page return redirect("/")
def scrape(): # Delete all records mongo.db.collection.remove({}) # Run the scrape function mars_data = scrape_mars.scrape_info() # Update the Mongo database using update and upsert=True mongo.db.collection.update({}, mars_data, upsert=True) # Redirect back to home page return redirect("/")
def scrape(): mongo.db.mars_collection.drop() # Run the scrape function all_mars_urls = scrape_mars.scrape_info() for url in all_mars_urls: # Dictionary to be inserted into MongoDB mongo.db.mars_collection.insert_one(url) # Update the Mongo database using update and upsert=True #collection.update({}, scrape_mars, upsert=True) # Redirect back to home page return redirect("/")
def scrape(): #Do a new Mars data scrape mars_data = scrape_mars.scrape_info() #Setup connection to mongodb conn = "mongodb://localhost:27017" client = pymongo.MongoClient(conn) # Select database and collection to use mars_info = db.mars_info mars_info.insert_one(mars_data) # Redirect back to home page return redirect("/")
def scrape(): # Run the scrape function #Latest New titles and news paragrah mars_info = scrape_mars.scrape_info() #Featured Mars Image mars_info = scrape_mars.scrape_info2() #Mars Facts mars_info = scrape_mars.scrape_info3() #Mars Hemisphere mars_info = scrape_mars.scrape_info4() # Update the Mongo database using update and upsert=True mongo.db.collection.update({}, mars_info, upsert=True) # Redirect back to home page return redirect("/", code=302)
def scrape(): mars = mongo.db.mars # news_title = "NASA Engineers Checking InSight's Weather Sensors" # news_p = "An electronics issue is suspected to be preventing the sensors from sharing their data about Mars weather with the spacecraft." # featured_image_url = "https://www.jpl.nasa.gov/spaceimages/images/largesize/PIA08003_hires.jpg" # img1_title = 'Cerberus Hemisphere Enhanced' # img1_url = 'https://astropedia.astrogeology.usgs.gov/download/Mars/Viking/cerberus_enhanced.tif/full.jpg' # img2_title = 'Schiaparelli Hemisphere Enhanced' # img2_url = 'https://astropedia.astrogeology.usgs.gov/download/Mars/Viking/schiaparelli_enhanced.tif/full.jpg' # img3_title = 'Syrtis Major Hemisphere Enhanced' # img3_url = 'https://astropedia.astrogeology.usgs.gov/download/Mars/Viking/syrtis_major_enhanced.tif/full.jpg' # img4_title = 'Valles Marineris Hemisphere Enhanced' # img4_url = 'https://astropedia.astrogeology.usgs.gov/download/Mars/Viking/valles_marineris_enhanced.tif/full.jpg' # mars_data = { # "news_title": news_title, # "news_p": news_p, # "featured_image_url": featured_image_url, # "img1_title": img1_title, # "img1_url": img1_url, # "img2_title": img2_title, # "img2_url": img2_url, # "img3_title":img3_title, # "img3_url": img3_url, # "img4_title": img4_title, # "img4_url": img4_url, # } mars_data = scrape_mars.scrape_info() # Update the Mongo database using update and upsert=True mars.update({}, mars_data, upsert=True) # Redirect back to home page return redirect("/")
def scrape(): mars = mongo.db.mars mars_data = scrape_mars.scrape_info() mars.replace_one({}, mars_data, upsert=True) return redirect("/")
def scrapemaster(): purpan = scrape_mars.scrape_info() mongo.db.collection.update({}, purpan, upsert=True) return redirect("/")