def scraper(): listings = mongo.db.listings print(listings.find()) listings_data = scrape_craigslist.scrape() print(listings_data) listings.update({}, listings_data, upsert=True) return redirect("/", code=302)
def scraper(): #create a listings collection listings = mongo.db.listings #call the scrape function in our scrap_craigslist file. This will scrape and save to Mongo listings_data = scrape_craigslist.scrape() #update our listings with the data that is being scraped listings.update({}, listings_data, upsert=True) #return a message to our page so we know it was successful return redirect("/", code=302)
def scraper(): listings = mongo.db.listings listings_data = scrape_craigslist.scrape() listings.update( {}, listings_data, upsert=True ) return redirect("http://localhost:5000/", code=302)
def scraper(): listings = mongo.db.listings listings_data = scrape_craigslist.scrape() print(f"listings_data: {listings_data}") listings.update_one({}, {"$set":listings_data}, upsert=True) return redirect("/", code=302)