Esempio n. 1
0
def scrape():
    mars_data = scrape_mars.mars_news()
    mars_data = scrape_mars.mars_image()
    mars_data = scrape_mars.mars_facts()
    mars_data = scrape_mars.mars_weather()
    mars_data = scrape_mars.mars_hemispheres()
    mongo.db.mars_info.update({}, mars_data, upsert=True)

    return redirect("/", code=302)
Esempio n. 2
0
def scrape():

    # Run scrapped functions
    mars_info = mongo.db.mars_info
    mars_data = scrape_mars.mars_news()
    mars_data = scrape_mars.mars_image()
    mars_data = scrape_mars.mars_facts()
    mars_data = scrape_mars.mars_hemispheres()
    mars_info.update({}, mars_data, upsert=True)

    return redirect("http://localhost:5000/", code=302)
Esempio n. 3
0
def scrape():

    #Run the scrape function
    mars_info = mongo.db.mars_info
    mars_data = scrape_mars.mars_news()
    mars_data = scrape_mars.mars_image()
    mars_data = scrape_mars.mars_twitter()
    mars_data = scrape_mars.mars_facts()
    mars_data = scrape_mars.mars_hemispheres()
    mars_info.update({}, mars_data, upsert=True)

    return redirect("/", code=302)
Esempio n. 4
0
def scrape():

    mars = mongo.db.collection

    mars_info = scrape_mars.scrape()
    mars_info = scrape_mars.mars_image()
    # mars_info = scrape_mars.mars_weather()
    mars_info = scrape_mars.mars_facts()
    mars_info = scrape_mars.mars_hemispheres()

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

    return redirect("/")
Esempio n. 5
0
def scrape():

    # Run the scrape function
    mars_data = scrape_mars.mars_news()
    mars_data = scrape_mars.mars_image()
    mars_data = scrape_mars.mars_weather()
    mars_data = scrape_mars.mars_facts()
    mars_data = scrape_mars.mars_hemispheres()

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

    # Redirect back to home page
    return redirect("/")
Esempio n. 6
0
def scrape():
    news = scrape_mars.mars_news()
    image = scrape_mars.mars_image()
    weather = scrape_mars.mars_weather()
    facts = scrape_mars.mars_facts()
    hemispheres = scrape_mars.mars_hemispheres()

    db.news.insert_one(news)
    db.image.insert_one(image)
    db.weather.insert_one(weather)
    for fact in facts:
        db.facts.insert_one(fact)
    for hemisphere in hemispheres:
        db.hemispheres.insert_one(hemisphere)
    return redirect("http://localhost:5000/", code=302)
Esempio n. 7
0
def scrape():

    # 1.
    # Run the Latest New scrape function:
    Latest_New = scrape_mars.NASA_Mars_News()

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

    # 2.
    # Run the featured image scrape function:
    featured_image = scrape_mars.featured_image()

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

    # 3.
    # Run the weather scrape function:
    mars_weather = scrape_mars.mars_weather()

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

    # 4.
    # Run the facts scrape function:
    mars_facts = scrape_mars.mars_facts()

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

    # 5.
    # Run the hemispheres scrape function:
    mars_hemispheres = scrape_mars.mars_hemispheres()

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

    # Redirect back to home page
    return redirect("/")
def scrape():

    # Run the scrape functions
    mars_table = mongo.db.mars_information
    news_title, news_paragraph = scrape_mars.scrape_mars_news()
    featured_img_url = scrape_mars.scrape_mars_image()
    mars_facts = scrape_mars.scrape_mars_facts()
    mars_hemispheres = scrape_mars.mars_hemispheres()

    mars_information = {
        "news_title": news_title,
        "news_paragraph": news_paragraph,
        "featured_image_url": featured_img_url,
        "mars_table": mars_facts,
        "hemisphere_image_urls": mars_hemispheres
    }

    print(mars_information)
    mars_table.update({}, mars_information, upsert=True)

    # Redirect back to home page
    return redirect("/", code=302)
Esempio n. 9
0
def scrape():
    news = scrape_mars.mars_news()
    try:
        db.news.insert_many(news)
        print("News Uploaded!")
    except TypeError as e:
        print("Mars News Error" + e)
    #Get featured image
    mars_pic = scrape_mars.mars_image()
    try:
        db.featured.insert_one(mars_pic)
        print("Feature Image Uploaded!")
    except TypeError as e:
        print("Feature Image Error" + e)
    #Get latest weather from Twitter
    weather = scrape_mars.mars_weather()

    try:
        db.weather.insert_one(weather)
        print("Weather Uploaded!")
    # Get mars facts table
    except TypeError as e:
        print("Weather Tweet Error" + e)

    facts = scrape_mars.mars_facts()
    try:
        db.facts.insert_one(facts)
        print("Facts Uploaded!")
        # Get images of mars hemispheres
    except TypeError as e:
        print("Mars Facts Error" + e)

    hems = scrape_mars.mars_hemispheres()
    try:
        db.images.insert_many(hems)
        print("Hemispheres Uploaded!")
    except TypeError as e:
        print("Hemisphere scrape error" + e)
Esempio n. 10
0
def scrape():
    # Scrape for latest Mars news and store in mongo database
    latest_mars_news = scrape_mars.latest_mars_news()
    mongo.db.latestMarsNews.update({}, latest_mars_news, upsert=True)

    # Scrape latest featured image and store in mongo database
    featured_image = scrape_mars.featured_image()
    mongo.db.featuredImage.update({}, featured_image, upsert=True)

    # Scrape latest Mars weather and store in mongo database
    weather = scrape_mars.current_mars_weather()
    mongo.db.marsWeather.update({}, weather, upsert=True)

    # Scrape Mars facts and store in mongo database
    mars_facts = scrape_mars.mars_facts()
    mongo.db.marsFacts.update({}, mars_facts, upsert=True)

    # Scrape Mars hemispheres and store in mongo database
    mars_hemispheres = scrape_mars.mars_hemispheres()
    mongo.db.marsHemispheres.drop()  # Refresh with new collection
    mongo.db.marsHemispheres.insert_many(mars_hemispheres)

    # Redirect back to home page
    return redirect("/")