def scrape(): listings = mongo.db.listings listings_data = scrape_mars.scrape_data() listings.update({}, listings_data, upsert=True) return redirect("/", code=302)
def scrape(): client = pymongo.MongoClient(conn) db = client.mars['Planet Info'] db.drop() db = client.mars['Planet Info'] data = scrape_mars.scrape_data() db.insert_one(data) return redirect('/')
def scrape(): collection = connectDB() # Run scraped functions mars = scrape_data() collection.update({"name": "Mars"}, {"$set": mars}, upsert = True) # Redirect back to home page return redirect("http://localhost:5000/", code=302)
def data_scrape(): mars_data = scrape_data() print(mars_data) # Update Mongo database #mongo.db.update({}, mars_data, upsert=True) # Redirect to index return redirect("/", code=302)
def scrape(): data = scrape_data() # Update the Mongo database using update and upsert=True mongo.db.mars.insert_one(data) return render_template('index.html', **{"title": "Mission to Mars"})
def scrape(): # Run the scrape function mars_data = scrape_mars.scrape_data() if mars_data != 'err': # Update the Mongo database using update and upsert=True mongo.db.scraped_data.update({}, mars_data, upsert=True) else: mars_data = scrape_mars.scrape_data() try: # Update the Mongo database using update and upsert=True mongo.db.scraped_data.update({}, mars_data, upsert=True) except: print('scrape_data() function failed 2x.') # Redirect back to home page return redirect("/")
def scrape(): # Run the scrape function data = scrape_data() # Update the Mongo database using update and upsert=True mongo.db.collection.update({}, data, upsert=True) # Redirect back to home page return redirect("/")
def scrape(): # run the scrape function web_data = scrape_data() # Update the Mongo database using update and upsert=True mongo.db.collection.update({}, web_data, upsert=True) # Redirect back to home page # return redirect("/", code = 302) #302 is default return redirect("/")
def scrape(): # Run the scrape function mars_data = scrape_mars.scrape_data() # Update the Mongo databae using supdate and upsert=True mongo.db.Mars_app.update({}, mars_data, upsert=True) # Redirect back to home page return redirect("/")
def scrape(): # run scrape function mars_data = scrape_mars.scrape_data() #update mongo db using update and upsert=True mongo.db.collection.update({}, mars_data, upsert=True) # Redirect back home return redirect("/")
def scrape(): #Define Database and Collection mars = mongo.db.mars #Call scrape_data Function in scrape_mars.py mars_data = scrape_mars.scrape_data() #Updating Collection mars.update({}, mars_data, upsert=True) #Redirect to Homepage return redirect("/")
def scrape(): # Run the scrape function result = scrape_mars.scrape_data() # Update Mongo database import pymongo conn = 'mongodb://localhost:27017/' client = pymongo.MongoClient(conn) #data base name db = client.mars_db collection = db.marsData # collection.insert_one(result) # collection.insert_many(result) collection.update({}, result, upsert=True) # Redirect back to home page return redirect("/")
def scrape(): mars_info = mongo.db.mars_info mars_data = scrape_mars.scrape_data() mars_info.update({}, mars_data, upsert=True) return redirect("/", code=302)
def data_scrape(): scraped = scrape_data() return jsonify(scraped)
def scrape_data(): mars_dict = mongo.db.mars_dict mars_data = scrape_mars.scrape_data() mars_dict.replace_one({}, mars_data, upsert=True) return redirect("/", code=302)
def scrape(): mars = mongo.db.mars mars_data = scrape_mars.scrape_data() mars.update({}, mars_data, upsert=True) return 'Scraping Successful!'
from flask import Flask, render_template, redirect import pymongo import scrape_mars app = Flask(__name__) conn = "mongodb://*****:*****@app.route('/') def home(): data = db.find_one() return render_template("index.html",\ article = data['Article'],\ featuredImg = data['Featured Image URL'],\ weather = data['Weather on Mars'],\ table = data['Table'],\ hemi1 = data['Hemisphere Images'][0],\ hemi2 = data['Hemisphere Images'][1],\ hemi3 = data['Hemisphere Images'][2],\ hemi4 = data['Hemisphere Images'][3]) @app.route('/scrape') def scrape(): client = pymongo.MongoClient(conn)
def scrape(): mars_data = scrape_mars.scrape_data() mongo.db.collection.update( {},mars_data,upsert=True) return redirect("/")
def scrape(): mars_data_scrape = scrape_mars.scrape_data() collection.update({}, mars_data_scrape, upsert=True) return redirect("/")