# catholic-mass-readings
[![CI Build](https://github.com/rcolfin/catholic-mass-readings/actions/workflows/ci.yml/badge.svg)](https://github.com/rcolfin/catholic-mass-readings/actions/workflows/ci.yml)
[![License](https://img.shields.io/github/license/rcolfin/catholic-mass-readings.svg)](https://github.com/rcolfin/catholic-mass-readings/blob/main/LICENSE)
[![PyPI Version](https://img.shields.io/pypi/v/catholic-mass-readings)](https://pypi.python.org/pypi/catholic-mass-readings)
[![versions](https://img.shields.io/pypi/pyversions/catholic-mass-readings.svg)](ttps://github.com/rcolfin/catholic-mass-readings)
Provides an API for scraping the web page from [Daily Readings](https://bible.usccb.org/bible/readings/) website of United States Conference of Catholic Bishops.
## Development
### Setup Python Environment:
Run [scripts/console.sh](../scripts/console.sh) poetry install
### If you need to relock:
Run [scripts/lock.sh](../scripts/lock.sh)
### Run code
Run [scripts/console.sh](../scripts/console.sh) poetry run python -m catholic_mass_readings
## API Usage:
```python
import asyncio
import datetime
from catholic_mass_readings import USCCB, models
# To get a mass for a particular date:
async with USCCB() as usccb:
mass = await usccb.get_mass(datetime.date(2024, 12, 25), models.MassType.VIGIL)
print(mass)
# To query for a range of Sunday masses:
async with USCCB() as usccb:
dates = usccb.get_sunday_mass_dates(datetime.date(2024, 12, 25), datetime.date(2025, 1, 25))
tasks = [usccb.get_mass_from_date(dt, types) for dt in dates]
responses = await asyncio.gather(*tasks)
masses = [m for m in responses if m]
masses.sort(key=lambda m: m.date.toordinal() if m.date else -1)
for mass in masses:
end = "\n" if mass is masses[-1] else "\n\n"
print(mass, end=end)
# To query for a range of masses (step how you want to):
async with USCCB() as usccb:
dates = usccb.get_mass_dates(datetime.date(2024, 12, 25), datetime.date(2025, 1, 25), step=datetime.timedelta(days=1))
tasks = [usccb.get_mass_from_date(dt) for dt in dates]
responses = await asyncio.gather(*tasks)
masses = [m for m in responses if m]
masses.sort(key=lambda m: m.date.toordinal() if m.date else -1)
for mass in masses:
end = "\n" if mass is masses[-1] else "\n\n"
print(mass, end=end)
# To query for a list of all the mass types on a particular date:
async with USCCB() as usccb:
mass_types = await usccb.get_mass_types(datetime.date(2024, 12, 25))
for mass_type in mass_types:
print(mass_type.name)
```
As a CLI
```sh
# To get a mass for a particular date:
python -m catholic_mass_readings get-mass --date 2024-12-25 --type vigil
# To query for a range of Sunday masses:
python -m catholic_mass_readings get-sunday-mass-range --start 2024-12-25 --end 2025-01-01
# To query for a range of masses (step how you want to):
python -m catholic_mass_readings get-mass-range --start 2024-12-25 --end 2025-01-01 --step 7
# To query for a list of mass types on a particular date:
python -m catholic_mass_readings get-mass-types --date 2025-12-25
# or saving to a file...
# To get a mass for a particular date:
python -m catholic_mass_readings get-mass --date 2024-12-25 --type vigil --save mass.json
# To query for a range of Sunday masses:
python -m catholic_mass_readings get-sunday-mass-range --start 2024-12-25 --end 2025-01-01 --save mass.json
# To query for a range of masses (step how you want to):
python -m catholic_mass_readings get-mass-range --start 2024-12-25 --end 2025-01-01 --step 7 --save mass.json
```
## Installation
To install catholic-mass-readings from PyPI, use the following command:
$ pip install catholic-mass-readings
You can also clone the repo and run the following command in the project root to install the source code as editable:
$ pip install -e .
## Documentation
The documentation for `catholic-mass-readings` can be found [here](https://rcolfin.github.io/catholic-mass-readings/) or in the project's docstrings.
Raw data
{
"_id": null,
"home_page": null,
"name": "catholic-mass-readings",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": "catholic, daily, lecture, mass, readings, scripture, usccb",
"author": "Robert Colfin",
"author_email": "robert.m.colfin@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/31/66/2e0b9c58c644e5d3202c6764cae9a7e8ae4be60c15cd20f2aa6cb6a798f6/catholic_mass_readings-0.4.3.tar.gz",
"platform": null,
"description": "# catholic-mass-readings\n\n[![CI Build](https://github.com/rcolfin/catholic-mass-readings/actions/workflows/ci.yml/badge.svg)](https://github.com/rcolfin/catholic-mass-readings/actions/workflows/ci.yml)\n[![License](https://img.shields.io/github/license/rcolfin/catholic-mass-readings.svg)](https://github.com/rcolfin/catholic-mass-readings/blob/main/LICENSE)\n[![PyPI Version](https://img.shields.io/pypi/v/catholic-mass-readings)](https://pypi.python.org/pypi/catholic-mass-readings)\n[![versions](https://img.shields.io/pypi/pyversions/catholic-mass-readings.svg)](ttps://github.com/rcolfin/catholic-mass-readings)\n\nProvides an API for scraping the web page from [Daily Readings](https://bible.usccb.org/bible/readings/) website of United States Conference of Catholic Bishops.\n\n## Development\n\n### Setup Python Environment:\n\nRun [scripts/console.sh](../scripts/console.sh) poetry install\n\n### If you need to relock:\n\nRun [scripts/lock.sh](../scripts/lock.sh)\n\n### Run code\n\nRun [scripts/console.sh](../scripts/console.sh) poetry run python -m catholic_mass_readings\n\n\n## API Usage:\n\n```python\nimport asyncio\nimport datetime\n\nfrom catholic_mass_readings import USCCB, models\n\n# To get a mass for a particular date:\nasync with USCCB() as usccb:\n mass = await usccb.get_mass(datetime.date(2024, 12, 25), models.MassType.VIGIL)\n print(mass)\n\n# To query for a range of Sunday masses:\nasync with USCCB() as usccb:\n dates = usccb.get_sunday_mass_dates(datetime.date(2024, 12, 25), datetime.date(2025, 1, 25))\n tasks = [usccb.get_mass_from_date(dt, types) for dt in dates]\n responses = await asyncio.gather(*tasks)\n masses = [m for m in responses if m]\n masses.sort(key=lambda m: m.date.toordinal() if m.date else -1)\n for mass in masses:\n end = \"\\n\" if mass is masses[-1] else \"\\n\\n\"\n print(mass, end=end)\n\n# To query for a range of masses (step how you want to):\nasync with USCCB() as usccb:\n dates = usccb.get_mass_dates(datetime.date(2024, 12, 25), datetime.date(2025, 1, 25), step=datetime.timedelta(days=1))\n tasks = [usccb.get_mass_from_date(dt) for dt in dates]\n responses = await asyncio.gather(*tasks)\n masses = [m for m in responses if m]\n masses.sort(key=lambda m: m.date.toordinal() if m.date else -1)\n for mass in masses:\n end = \"\\n\" if mass is masses[-1] else \"\\n\\n\"\n print(mass, end=end)\n\n# To query for a list of all the mass types on a particular date:\nasync with USCCB() as usccb:\n mass_types = await usccb.get_mass_types(datetime.date(2024, 12, 25))\n for mass_type in mass_types:\n print(mass_type.name)\n```\n\nAs a CLI\n\n```sh\n# To get a mass for a particular date:\npython -m catholic_mass_readings get-mass --date 2024-12-25 --type vigil\n\n# To query for a range of Sunday masses:\npython -m catholic_mass_readings get-sunday-mass-range --start 2024-12-25 --end 2025-01-01\n\n# To query for a range of masses (step how you want to):\npython -m catholic_mass_readings get-mass-range --start 2024-12-25 --end 2025-01-01 --step 7\n\n# To query for a list of mass types on a particular date:\npython -m catholic_mass_readings get-mass-types --date 2025-12-25\n\n# or saving to a file...\n\n# To get a mass for a particular date:\npython -m catholic_mass_readings get-mass --date 2024-12-25 --type vigil --save mass.json\n\n# To query for a range of Sunday masses:\npython -m catholic_mass_readings get-sunday-mass-range --start 2024-12-25 --end 2025-01-01 --save mass.json\n\n# To query for a range of masses (step how you want to):\npython -m catholic_mass_readings get-mass-range --start 2024-12-25 --end 2025-01-01 --step 7 --save mass.json\n```\n\n## Installation\n\nTo install catholic-mass-readings from PyPI, use the following command:\n\n $ pip install catholic-mass-readings\n\nYou can also clone the repo and run the following command in the project root to install the source code as editable:\n\n $ pip install -e .\n\n## Documentation\nThe documentation for `catholic-mass-readings` can be found [here](https://rcolfin.github.io/catholic-mass-readings/) or in the project's docstrings.\n",
"bugtrack_url": null,
"license": "Apache",
"summary": "Provides an API for scraping the web page from https://bible.usccb.org/bible/readings/ to get the readings",
"version": "0.4.3",
"project_urls": null,
"split_keywords": [
"catholic",
" daily",
" lecture",
" mass",
" readings",
" scripture",
" usccb"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e12453eeaee38a4a90e8925ff609241dfdbf3ec6affbae07662b35bcd5e95dc5",
"md5": "3c1825832ff6baa97bdeb1b0e47be0bb",
"sha256": "288094f776d662c0263a888fdd527338f69b4686944954e3e7784fc14c4c30ff"
},
"downloads": -1,
"filename": "catholic_mass_readings-0.4.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3c1825832ff6baa97bdeb1b0e47be0bb",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 20321,
"upload_time": "2024-12-31T12:38:16",
"upload_time_iso_8601": "2024-12-31T12:38:16.333289Z",
"url": "https://files.pythonhosted.org/packages/e1/24/53eeaee38a4a90e8925ff609241dfdbf3ec6affbae07662b35bcd5e95dc5/catholic_mass_readings-0.4.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "31662e0b9c58c644e5d3202c6764cae9a7e8ae4be60c15cd20f2aa6cb6a798f6",
"md5": "02f920bcd0bfbd36f4382bfbf160034e",
"sha256": "45b5371c97ff3c9f441d7407c914b8176b94260f7690b5ee58a75af1ed41addb"
},
"downloads": -1,
"filename": "catholic_mass_readings-0.4.3.tar.gz",
"has_sig": false,
"md5_digest": "02f920bcd0bfbd36f4382bfbf160034e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 18541,
"upload_time": "2024-12-31T12:38:24",
"upload_time_iso_8601": "2024-12-31T12:38:24.725590Z",
"url": "https://files.pythonhosted.org/packages/31/66/2e0b9c58c644e5d3202c6764cae9a7e8ae4be60c15cd20f2aa6cb6a798f6/catholic_mass_readings-0.4.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-31 12:38:24",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "catholic-mass-readings"
}