def scraper(): mars_info = mongo.db.mars_info mars_data = scrape_mars.Scrape() print('result from scrape_mars.Srape()') print(mars_data) mars_info.update({}, mars_data, upsert=True) return redirect("/", code=302)
def scrape_route(): print('Scraping Mars data...') db.collection.remove() new_data = scrape_mars.Scrape() db.collection.insert_one(new_data) # data = scrape_mars.Scrape() # print("Scrape return:") # print(data) # # test = collection.find_one({"uniqueID":"1"}) # # print("Find in Mongo") # # pprint(test) # collection.update( # {"id":"1"}, # {'$set':data}, # upsert=True # ) # print("After update") # test = collection.find_one({"id":"1"}) # pprint(test) # print("MongoDB updated") # # mongod.terminate() return redirect("http://localhost:5000/", code=302)
def scrape(): mars_info = db.mars_db mars_data = scrape_mars.Scrape() mars_info.update( {}, mars_data, upsert = True ) return index()
def scrape(): #find scraping command in from scrape_mars.py mars_dict = scrape_mars.Scrape() #add information to the dictionary post = { 'news_title': mars_dict['news_title'], 'news_para': mars_dict['news_p'], 'featured_image_url': mars_dict['featured_image_url'], 'mars_weather': mars_dict['mars_weather'], 'html_table': mars_dict['html_table'] } # Delete previous content mongo.db.mars_info.drop() # Insert new Mars info mongo.db.mars_info.insert_one(post) # Redirect back to home page return redirect("/")
def scrape(): mars_data = mongo.db.mars new_data = scrape_mars.Scrape() mars_data.update({}, new_data, upsert=True) return redirect("/", code="302")
def scrapper(): mars_db = mongo.db.mars_db mars_data = scrape_mars.Scrape() mars_db.update({}, mars_data, upsert=True) return "Scraping Successful"
def scrape(): mars_info = db.mars mars_dict = scrape_mars.Scrape() mars_info.update({}, mars_dict, upsert=True) return redirect("http://localhost:5000/", code=302)