Пример #1
0
def scrape():
    # Run the scrape function
    mars_data = mission_to_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("/")
Пример #2
0
def scraper():
    #Run the scrape function
    mars_data = mongo.db.mars_data
    mars_data_data = mission_to_mars.scrape_info()
    #Update the Mongo database using update and insert=True)
    mars_data.update({},mars_data_data,upsert=True)

    #Redirect back to the home page
    return redirect("/", code=302)
Пример #3
0
def scrape():

    # Run the scrape function // 
    mars_mongo = mission_to_mars.scrape_info()

    # Update the Mongo database using update and upsert=True
    mongo.db.collection.update({}, mars_mongo, upsert=True)

    # Redirect back to home page
    return render_template('mars.html', mars_mongo=mars_mongo)
Пример #4
0
def scrape():
    
     # Run the scrape function
    scraped_dict = mission_to_mars.scrape_info()
    for i in scraped_dict:
        scraped_dict = scraped_dict + i
   
    # Update the Mongo database using update and upsert=True
    db.mars_db.insert(scraped_dict)
    
    # Redirect back to home page
    return redirect("/")
Пример #5
0
def scrape():
    mars_data = mission_to_mars.scrape_info()
    mongo.db.collection.update({}, mars_data, upsert=True)
    return redirect("/")