The purpose of this project is to build a web application that scrapes various websites for data related to the mission to Mars. It displays information in a single HTML page.
Scraping is done using Jupyter Notebook, BeautifulSoup, Pandas, and Splinter.
Scrape the NASA Mars News Site and collect the latest news title and paragraph text.
Visit the url for JPL Featured Space Image here. Use splinter to navigate the site and find the full size jpg image url for the current Featured Mars Image.
Scrape the latest Mars weather tweet from Mars Weather twitter account here.
Visit the Space Facts webpage, Mars facts page here. Use Pandas to scrape the table containing facts about the planet including Diameter, Mass, etc. Use Pandas to convert the data to HTML table string.
Visit the USGS Astrogeology site here to obtain high resolution images for each of Mars' hemispheres.
Click each of the links to the hemispheres in order to find the image url to the full resolution image.
Save both the image url string for the full resolution hemisphere image, and the Hemisphere title containing the hemisphere name. Use a Python dictionary to store the data using the keys img_url
and title
.
Append the dictionary with the image url string and the hemisphere title to a list. This list will contain one dictionary for each hemisphere.
Use MongoDB with Flask templating to create a new HTML page that displays all of the information that was scraped from the URLs above.
-
Convert Jupyter notebook into a Python script called
scrape_mars.py
with a function calledscrape
that will execute all scraping code from above and return one Python dictionary containing all of the scraped data. -
Create a route called
/scrape
that will importscrape_mars.py
script and callscrape
function. -
Store the return value in Mongo as a Python dictionary.
-
Create a root route
/
that will query Mongo database and pass the mars data into an HTML template to display the data. -
Create a template HTML file called
index.html
that will take the mars data dictionary and display all of the data in the appropriate HTML elements.