Skip to main content

A package to get the data from onthisday.com.

Project description

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

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

thisday-1.0.tar.gz (45.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

thisday-1.0-py3-none-any.whl (29.1 kB view details)

Uploaded Python 3

File details

Details for the file thisday-1.0.tar.gz.

File metadata

  • Download URL: thisday-1.0.tar.gz
  • Upload date:
  • Size: 45.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.0

File hashes

Hashes for thisday-1.0.tar.gz
Algorithm Hash digest
SHA256 d64e481341648ed4fefa59e5492cde754bb997720dccdb0579c0a9d221206557
MD5 aec9017f73a17b0dfde7115e51cb9c04
BLAKE2b-256 c7bb9023b6a169d02460c0c810f28f3d510fb8a5aad648a32397a8a2cb8acb16

See more details on using hashes here.

File details

Details for the file thisday-1.0-py3-none-any.whl.

File metadata

  • Download URL: thisday-1.0-py3-none-any.whl
  • Upload date:
  • Size: 29.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.0

File hashes

Hashes for thisday-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e792cdfef14be7e05157d0f7db219451e90cc89294a444f350b37ed978c36b35
MD5 cf784d1873628a6e05c0a828d8c3b7cc
BLAKE2b-256 8f799bd9727f0dec7363ac98af54937ee51647b1a93caa3334fda50450234a43

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page