thisday
is a command line tool that accesses onthisday.com to give the user events that occurred for that day.
It is recommended to install the package in a virtual environment, though one can install globally by using pip
instead of pipenv
where it appears should they please.
Note that this package is intended for command line use only.
- install
thisday
viapipenv
$ pipenv install thisday
- enter virtual environment
$ pipenv shell
- now that you are in the virtual environment, install package dependencies
bs4
andrequests
(andpytest
if you want to run tests)
$ pipenv install beautifulsoup4 requests pytest
- use the terminal to type the command
thisday [option]
, valid options include: history, film-tv, sport, music
$ thisday history
$ thisday film-tv
$ thisday sport
$ thisday music
-
Learn about what happened on this day!
-
To exit the virtual environment, run the
exit
command within the shell (skip if not using a virtual environment)
$ exit
We have provided a shell script demonstrating the functionality of our package.
Params: args
(argument for the function)
Returns: content retrieved from website if runs correctly, or an error message if something went wrong
Description: Main driver function of the package
Params: inputString
(a string for input)
Returns: the input string if it is valid, or an error message if it is not
Description: Function to check if the argument is valid for the package
Params: option
(a string returned from process_input)
Returns: A BeautifulSoup object generated from the website if option is valid, or 0 if option is invalid
Description: Function to connect to the respective URL for each input option
Params: soup
(a BeautifulSoup object returned from connect)
Returns: a list of strings retrieved from the website, or 0 if failed to retrieve
Description: Function to retrieve data from the URL
Params: my_data
(a list of strings returned from get_events)
Returns: a string if the list is valid, or 0 if not
Description: Function that displays data to the user
If you would like to test the package, download the package files to your machine. Then, within the directory of the download, follow the steps 1 and 2 in how to use the package to create and enter the virtual environment, then run the following command to run the test file:
$ pytest
OR
$ python3 -m pytest
Tip: When working on the package, it might be helpful to install the package in editable mode, so that changes to the package are immediately updated in the virtual environment. To do this, run pipenv install -e .
from the main directory of the project