Пример #1
0
def scraper():
    # Run the scrape function and save the results to a variable
    results = scrape_mars.mars_scrape()

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

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

    # Run the scrape function
    mars_data = scrape_mars.mars_scrape()

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

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

    #Run the scrape function
    mars_dict = scrape_mars.mars_scrape()

    #Insert into database
    mongo.db.collection.update({}, mars_dict, upsert=True)

    #coll.update({'id': 1}, {'$set': mars_mission_data}, upsert=True)

    #Redirect back to homepage
    return redirect("/")
Пример #4
0
def scrape():
    """
		Create Mars Mongodb, call scrape routine and then upsert scraped data to Mongodb
	"""
    mars = mongo.db.mars
    data = mars_scrape()
    # print(data['news_title'])
    # print(data['news_p'])
    # print(data['images_url'])
    # print(data['mars_weather'])
    # print(data['mars_html_table'])
    # print(data['mars_images'])
    mars.update({}, data, upsert=True)
    return redirect("http://localhost:5000/", code=302)
Пример #5
0
def scrape():

    mars_info = mongo.db.mars_info

    mars_parts = scrape_mars.mars_scrape()

    # mars_parts = {
    #     'news_title': scrape_mars.mars_news_scrape(),
    #     'feature_photo_url' : scrape_mars.mars_feature_img_scrape(),
    #     'mars_weather' : scrape_mars.mars_weather(),
    #     'mars_html_table' : scrape_mars.mars_facts(),
    #     'hemisphere_img_urls' : scrape_mars.mars_hemis()
    # }

    mars_info.update({}, mars_parts, upsert=True)

    return redirect("/", code=302)
Пример #6
0
def scrape():
    mars_dict = scrape_mars.mars_scrape()
    mongo.db.collection.update({}, mars_dict, upsert=True)
    return redirect("/")
Пример #7
0
def scrape():
    mars_mission_data = mars_scrape()
    collection.update({"id": 1}, {"$set": mars_mission_data}, upsert=True)

    #return redirect("http://localhost:5000/", code=302)
    return ("Task complete")
Пример #8
0
def scrape():
    mars = mongo.db.mars
    data = scrape_mars.mars_scrape()
    mars.update({}, data, upsert=True)

    return redirect("/", code=302)
Пример #9
0
def scrape():
    mars_scrape = scrape_mars.mars_scrape()
    collection.update({}, {"$set": mars_scrape}, upsert=True)

    return redirect("http://localhost:5000/", code=302)
Пример #10
0
def scrape():
    marsinfo = mongo.db.marsdata
    # Run scrapped functions
    _mars = scrape_mars.mars_scrape()
    marsinfo.replace_one({}, _mars, upsert=True)
    return "Scraping Succefull"