示例#1
0
def scrape():

    # Scraped functions
    mars_db = mongo.db.mars_info
    scrape_mars.scrape_mars_news()
    scrape_mars.scrape_mars_image()
    scrape_mars.scrape_mars_weather()
    scrape_mars.scrape_mars_facts()
    scrape_mars.scrape_mars_hemispheres()
    # mars_info={'key1':'test'}
    mars_db.update({}, mars_info, upsert=True)
    mongo.db.collection.update({}, mars_data, upsert=True)
示例#2
0
def scrappe():
    mars_mongo = mongo.db.mars_info
    mars_info = scrape_mars.scrape_mars_news()
    mars_info = scrape_mars.scrape_mars_facts()
    mars_info = scrape_mars.scrape_mars_hemispheres()
    mars_mongo.update({},mars_info,upsert=True)
    return redirect("/")
示例#3
0
def scrape():
    try:
        mars_news = scrape_mars.scrape_mars_news()
        mars_image = scrape_mars.scrape_mars_image()
        mars_facts = scrape_mars.scrape_mars_facts()
        mars_weather = scrape_mars.scrape_mars_weather()
        data = scrape_mars.scrape_mars_facts()
        mars_hemispheres = scrape_mars.scrape_mars_hemispheres()

        # Create Mission to Mars dictionary, which will be imported into Mongo
        mars_info = {}

        # Dictionary entry from MARS NEWS
        mars_info['news_title'] = mars_news[0]
        mars_info['news_paragraph'] = mars_news[1]
        # Dictionary entry from fetured image created in line 14
        mars_info['featured_image_url'] = mars_image
        # Dictionary entry from Weather twitts
        mars_info['weather_tweet'] = mars_weather
        # Dictionary entry from MARS FACTS
        mars_info['mars_facts'] = data
        mars_info['hiu'] = mars_hemispheres

        db.mars.update({}, mars_info, upsert=True)
        mars_info_data = db.mars.find_one()
    except:
        mars_info_data = db.mars.find_one()

    return render_template("index.html", mars_info=mars_info_data)
示例#4
0
def scrape():

    # Run the scrape function
    mars_data = scrape_mars.scrape_mars_news()
    print(mars_data)
    # Update the Mongo database using update and upsert=True
    mongo.db.news_collection.update({}, mars_data, upsert=True)

    # Run the scrape function
    featured_image_url = scrape_mars.scrape_mars_image()
    print(featured_image_url)
    # Update the Mongo database using update and upsert=True
    mongo.db.image_collection.update({}, featured_image_url, upsert=True)

    # Run the scrape function
    mars_facts_data = scrape_mars.scrape_mars_facts()
    print(mars_facts_data)
    records = json.loads(mars_facts_data.T.to_json()).values()
    mongo.db.facts_collection.drop()
    mongo.db.facts_collection.insert(records)

    # Run the scrape function
    mars_hems_data = scrape_mars.scrape_mars_hemispheres()
    print(mars_hems_data)
    mongo.db.mars_hems_data.update({}, mars_hems_data, upsert=True)

    # Redirect back to home page
    return redirect("/")
示例#5
0
def scrape():

    mars_news = mongo.db.mars_news
    mars_data = scrape_mars.scrape_mars_news()
    mars_data = scrape_mars.featured_image()
    mars_data = scrape_mars.mars_facts()
    mars_info.update({}, mars_data, upsert=True)

    return redirect("/")
示例#6
0
def scrape():
    #Run scrape function
    mars_data = scrape_mars.scrape_mars_news()

    #Update db
    mongo_db_collection.update({scraped_data}, mars_data, upsert=True)

    #Return to home pg
    return redirect("/")
def scrape():

    mars_db = mongo.db.mars_db
    mars_data = scrape_mars.scrape_mars_news()
    mars_data = scrape_mars.scrape_mars_facts()
    mars_data = scrape_mars.scrape_mars_weather()
    mars_db.update({}, mars_data, upsert=True)

    return redirect("/", code=302)
示例#8
0
def scrape():
    mars_info = mongo.db.mars_info
    mars_data = scrape_mars.scrape_mars_news()
    mars_data = scrape_mars.scrape_mars_image()
    mars_data = scrape_mars.scrape_mars_facts()
    mars_data = scrape_mars.scrape_mars_weather()
    mars_data = scrape_mars.scrape_mars_hemispheres()
    mars_info.update({}, mars_data, upsert=True)
    return redirect("/", code=302)
示例#9
0
def scrape():
    mission_to_mars = mongo.db.mission_to_mars
    mars_data = scrape_mars.scrape_mars_news()
    mars_data = scrape_mars.scrape_mars_image()
    mars_data = scrape_mars.scrape_mars_weather()
    mars_data = scrape_mars.scrape_mars_facts()
    mars_data = scrape_mars.scrape_mars_hemisphere()
    mission_to_mars.update({}, data, upsert=True)

    return redirect("/", code=302)
示例#10
0
def scrape():
    mars_data = scrape_mars.scrape_mars_news()
    mars_data = scrape_mars.scrape_mars_featured_image()
    mars_data = scrape_mars.scrape_mars_weather()
    mars_data = scrape_mars.scrape_mars_facts()
    mars_data = scrape_mars.scrape_mars_hemisphere()

    mongo.db.collection.update({}, mars_data, upsert=True)

    return redirect("/", code= 302)
示例#11
0
def scrape():

    # Run scrapped functions
    mars_info = mongo.db.mars_info
    mars_data = scrape_mars.scrape_mars_news()
    mars_data = scrape_mars.scrape_mars_image()
    mars_data = scrape_mars.scrape_mars_hemisphere()
    mars_info.update({}, mars_data, upsert=True)

    return request("/", code=302)
def scrape():
    mars_data = db.mars_info
    mars_fact = scrape_mars.scrape_mars_news()
    mars_fact = scrape_mars.scrape_mars_image()
    mars_fact = scrape_mars.scrape_mars_weather()
    mars_fact = scrape_mars.scrape_mars_facts()
    mars_fact = scrape_mars.scrape_mars_hemispheres()
    mars_data.update({}, mars_fact, upsert=True)
    # redirecting the route we are the code
    return redirect("/", code=302)
def scrape():

    # Run scrapped functions
    mars_info = mongo.db.mars_info
    mars_data = scrape_mars.scrape_mars_news()
    mars_data = scrape_mars.scrape_mars_images()
    mars_f = scrape_mars.scrape_mars_facts()
    mars_data = scrape_mars.scrape_mars_hemi()
    mars_info.update({}, mars_data, upsert=True)

    return redirect("/", code=302)
def scrape():
    # Run scraped functions
    mars_info = mongo.db.scrape_mars_info
    mars_data = scrape_mars.scrape_mars_news()
    mars_data = scrape_mars.scrape_mars_image()
    mars_data = scrape_mars.scrape_mars_facts()
    mars_data = scrape_mars.scrape_mars_weather()
    mars_data = scrape_mars.scrape_mars_hemispheres()
    mars_info.update({}, mars_data, upsert=True)

    return redirect("/") 
示例#15
0
def scrape():

    # Run scrapped functions
    mars_info = scrape_mars.scrape_mars_news()
    mars_info = scrape_mars.scrape_mars_image()
    mars_info = scrape_mars.scrape_mars_facts()
    mars_info = scrape_mars.scrape_mars_weather()
    mars_info = scrape_mars.scrape_mars_hemispheres()
    mongo.db.mars_collection.update({}, mars_info, upsert=True)

    return redirect("/", code=302)
示例#16
0
def scraper():
    mars_data = mongo.db.mars_data
    data = scrape_mars.scrape_mars_news()
    mars_data.update({}, data, upsert=True)
    data = scrape_mars.scrape_mars_images()
    mars_data.update({}, data, upsert=True)
    data = scrape_mars.scrape_mars_facts()
    mars_data.update({}, data, upsert=True)
    data = scrape_mars.scrape_mars_weather()
    mars_data.update({}, data, upsert=True)
    data = scrape_mars.scrape_mars_hemispheres()
    mars_data.update({}, data, upsert=True)
示例#17
0
def scrape():

    # Run scrapped functions
    mars_dict = mongo.db.mars_dict
    mars_data = scrape_mars.scrape_mars_news()
    mars_data = scrape_mars.scrape_mars_featured_image()
    mars_data = scrape_mars.scrape_mars_weather()
    mars_data = scrape_mars.scrape_mars_facts()
    mars_data = scrape_mars.scrape_mars_hemispheres()
    mars_dict.update({}, mars_data, upsert=True)

    return redirect("/", code=302)
示例#18
0
def scraper():

    # run scraped functions
    mars_info = mongo.db.mars_info
    mars_data = scrape_mars.scrape_mars_news()
    marsfacts = scrape_mars.scrape_mars_facts()
    marshem = scrape_mars.scrape_mars_hemispheres()
    marsimg = scrape_mars.scrape_mars_image()

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

    return redirect("/", code=302)
示例#19
0
def scrape():
    mars = mongo.db.mars
    # Run the scrape function
    mars_info = mongo.db.mars_info
    mars_data = scrape_mars.scrape_mars_news()
    mars_data = scrape_mars.scrape_mars_image()
    mars_data = scrape_mars.scrape_mars_facts()
    mars_data = scrape_mars.scrape_mars_weather()
    mars_data = scrape_mars.scrape_mars_hemispheres()
    # Update the Mongo database using update and upsert=True
    mars.update({}, mars_data, upsert=True)
    # Redirect back to home page
    return redirect("/", code=302)
示例#20
0
def scrape():

    # Run scrape functions
    mars_info = client.db.mars_info
    mars_data = scrape_mars.scrape_mars_news()
    mars_data = scrape_mars.scrape_mars_image()
    mars_data = scrape_mars.scrape_mars_facts()
    mars_data = scrape_mars.scrape_mars_weather()
    mars_data = scrape_mars.scrape_mars_hemispheres()
    mars_info.update({}, mars_data, upsert=True)

    # return "Scraped!"
    return redirect("/", code=302)
示例#21
0
def scrape():

    # Run scrapped functions
    mars_info = mongo.db.mars_info
    mars_data = {}
    mars_data["news"] = scrape_mars.scrape_mars_news()
    mars_data["image"] = scrape_mars.scrape_mars_image()
    mars_data["facts"] = scrape_mars.scrape_mars_facts()
    mars_data["weather"] = scrape_mars.scrape_mars_weather()
    mars_data["hemispheres"] = scrape_mars.scrape_mars_hemispheres()
    mars_info.update({}, mars_data, upsert=True)

    return redirect("/", code=302)
示例#22
0
def scrape():

    # Run scrapped functions
    mars_data = scrape_mars.scrape_mars_news()
    mars_data = scrape_mars.scrape_mars_featured_image()
    mars_f = scrape_mars.scrape_mars_facts()
    mars_data = scrape_mars.scrape_mars_hemi()

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

    # Redirect back to home page
    return redirect("/", code=302)
示例#23
0
def scrape():

    # Run the scrape function
    mars_data = scrape_mars.scrape_mars_news()
    mars_data = scrape_mars.scrape_mars_feat_image()
    mars_data = scrape_mars.scrape_mars_weather()
    mars_data = scrape_mars.scrape_mars_facts()
    mars_data = scrape_mars.scrape_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("/")
示例#24
0
def scrape():

    # Run scraped functions  
    mars_mission = mongo.db.mars_mission
    mars_data = scrape_mars.scrape_mars_news()
    mars_data = scrape_mars.scrape_mars_image()
    mars_data = scrape_mars.scrape_mars_weather()
    mars_data = scrape_mars.scrape_mars_facts()
    mars_data = scrape_mars.scrape_mars_hemisphers()
    
    mars_mission.update({}, mars_data, upsert=True)

    # Redirect back to home page
    return redirect("/", code=302)
示例#25
0
def scrape():
    mars_info = mongo.db.mars_info
    # Run the scrape function

    mars_content = scrape_mars.scrape_mars_news()
    mars_content = scrape_mars.scrape_img()
    mars_content = scrape_mars.scrape_weather()
    mars_content = scrape_mars.scrape_facts()
    mars_content = scrape_mars.scrape_hemisphere()

    # Update the Mongo database using update and upsert=True
    mars_info.update({}, mars_content, upsert=True)

    # Redirect back to home page
    return redirect("/")
示例#26
0
def scrape(): 

    # Run scrapped functions
    mars_data = mongo.db.mars_final_info
    mars_data = scrape_mars.scrape_mars_news()
    mars_data = scrape_mars.jpl_mars_space_images()
    mars_data = scrape_mars.scrape_mars_facts()
    mars_data = scrape_mars.scrape_mars_weather()
    mars_data = scrape_mars.scrape_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("/")
示例#27
0
def scrape():

    # Run the scrape function
    mars_data = mongo.db.mars_data
    mars_info = {}

    mars_info['news'] = scrape_mars.scrape_mars_news()
    mars_info['featured'] = scrape_mars.scrape_mars_featured()
    mars_info['facts'] = scrape_mars.scrape_mars_facts()
    mars_info['mars_hemisphere'] = scrape_mars.scrape_mars_hemisphere()

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

    # Redirect back to home page
    return redirect("/")
def scraper():
    # Run scrapped functions
    mars_info = mongo.db.mars
    mars_news = scrape_mars.scrape_mars_news()
    mars_image = scrape_mars.scrape_mars_image()
    mars_facts = scrape_mars.scrape_mars_facts()
    mars_weather = scrape_mars.scrape_mars_weather()
    mars_hemispheres = scrape_mars.scrape_mars_hemispheres()

    mars_data = mars_news
    mars_data.update(mars_image)
    mars_data.update(mars_facts)
    mars_data.update(mars_weather)
    mars_data.update(mars_hemispheres)

    mars_info.update({}, mars_data, upsert=True)
    return redirect("/", code=302)
示例#29
0
def scrape(): 
   # Run scraping function
    # news = scrape_mars.scrape()

    # Store results into a dictionary

# Run scrapped functions
    #mars_info = mongo.mars_facts.mars_info
    mars_data = scrape_mars.scrape_mars_news()
    mars_data = scrape_mars.scrape_mars_image()
    mars_data = scrape_mars.scrape_mars_facts()
    mars_data = scrape_mars.scrape_mars_weather()
    mars_data = scrape_mars.scrape_mars_hemispheres()
    #mars_info.update({}, mars_data, upsert=True)
    mongo.db.mars_facts.insert_one(mars_data)

    return redirect("/", code=302)
示例#30
0
def scrape(): 

    # Run scrapped functions
    # mars_info = mongo.db.mars_info
    # mars_data = scrape_mars.scrape()
    # mars_info.update({}, mars_data, upsert=True)
    # return redirect("/", code=302)
    mars_info = mongo.db.mars_info
    mars_data = scrape_mars.scrape_mars_news()
    print(mars_data)
    mars_data = scrape_mars.scrape_mars_image()
    print(mars_data)
    mars_data = scrape_mars.scrape_mars_facts()
    print(mars_data)
    # mars_data = scrape_mars.scrape_mars_weather()
    mars_data = scrape_mars.scrape_mars_hemispheres()
    print(mars_data)
    mars_info.update({}, mars_data, upsert=True)

    return redirect("/", code=302)