8000 GitHub - danilo-montes-code/thisday: thisday
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

danilo-montes-code/thisday

Repository files navigation

Build & Test

thisday

thisday is a command line tool that accesses onthisday.com to give the user events that occurred for that day.

How to use the package

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.

  1. install thisday via pipenv
$ pipenv install thisday
  1. enter virtual environment
$ pipenv shell
  1. now that you are in the virtual environment, install package dependencies bs4 and requests (and pytest if you want to run tests)
$ pipenv install beautifulsoup4 requests pytest
  1. 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
  1. Learn about what happened on this day!

  2. To exit the virtual environment, run the exit command within the shell (skip if not using a virtual environment)

$ exit

Test program

We have provided a shell script demonstrating the functionality of our package.

Package functions

run

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

process_input

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

connect

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

get_events

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

show

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

Testing locally

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

Authors

Anvi Agarwal
Danilo Montes
Leo Xu
Otis Lu

PyPI Page

Package on PyPI

Releases

No releases published

Packages

No packages published

Contributors 5

0