This project is part of the Udacity Full Stack Developer Nanodegree. The goal is to create a python file that fetches a defined set of results (goals) when executed.
- Display the most popular three articles of all time, sorted by most popular first
- Display the most popular authors of all time, sorted by the most popular first
- Display which days requests which lead to errors is more than 1%
- The database name is named
news
articles | |
---|---|
author | int |
title | text |
slug | text |
lead | text |
body | text |
time | timestamp tz |
id | int |
authors | |
---|---|
name | text |
bio | text |
id | int |
log | |
---|---|
path | text |
ip | inet |
method | text |
status | text |
time | timestamp tz |
id | int |
This project requires a database and vagrant box supplied by Udacity when participating in this project.
- The vagrant box template is available here.
- The newsdata.zip file is available here.
- You'll also need to install the psycopg2 module.
- Extract the vagrant box folder
- Extract newsdata.sql inside the vagrant folder
- cd into the vagrant folder
- Start the Vagrant box: Run
vagrant up
(this will begin the box download, which may take a while depending on the speed of your internet connection) - Install psycopg2 for Python3
- Install the database: (Still inside the vagrant folder) run
psql -d news -f newsdata.sql
- Run
python logsanalysis.py
in bash (orpython3 logsanalysis.py
if you have both Python2 and 3 installed).
-
Python file is PEP-8 checked
-
The most popular 3 articles of all time are:
Candidate is jerk, alleges rival - 338647 views
Bears love berries, alleges bear - 253801 views
Bad things gone, say good people - 170098 views
- The most popular authors of all time are:
Ursula La Multa - 507594 views
Rudolf von Treppenwitz - 423457 views
Anonymous Contributor - 170098 views
Markoff Chaney - 84557 views
- Days on which more than 1% of the requests lead to errors:
2016-07-17 - 2.3% errors