Provides an API for scraping the web page from https://bible.usccb.org/bible/readings/ to get the readings
Project description
catholic-mass-readings
Provides an API for scraping the web page from Daily Readings website of United States Conference of Catholic Bishops.
Development
Setup Python Environment:
Run scripts/console.sh poetry install
If you need to relock:
Run scripts/lock.sh
Run code
Run scripts/console.sh poetry run catholic_mass_readings
API Usage:
import datetime
from catholic_mass_readings import USCCB
# To get a mass for a particular date:
async with USCCB() as usccb:
mass = await usccb.get_mass_from_date(datetime.date(2024, 12, 25))
print(mass.dumps())
# To query for a range of Sunday masses:
async with USCCB() as usccb:
masses: list[models.Mass] = []
dates = usccb.get_sunday_mass_dates(datetime.date(2024, 12, 25), datetime.date(2024, 1, 25))
for task in asyncio.as_completed([usccb.get_mass_from_date(dt) for dt in dates]):
mass = await task
if mass:
print(mass.dumps())
masses.sort(key=lambda m: m.date.toordinal() if m.date else -1)
print(mass.dumps())
# To query for a range of masses (step how you want to):
async with USCCB() as usccb:
masses: list[models.Mass] = []
dates = usccb.get_mass_dates(datetime.date(2024, 12, 25), datetime.date(2024, 1, 25), step=datetime.timedelta(days=1))
for task in asyncio.as_completed([usccb.get_mass_from_date(dt) for dt in dates]):
mass = await task
if mass:
print(mass.dumps())
masses.sort(key=lambda m: m.date.toordinal() if m.date else -1)
print(mass.dumps())
As a CLI
# To get a mass for a particular date:
python -m catholic_mass_readings get-mass --date 2024-12-25
# 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
...Or saving to a file
# To get a mass for a particular date:
python -m catholic_mass_readings get-mass --date 2024-12-25 --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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file catholic_mass_readings-0.1.0.tar.gz.
File metadata
- Download URL: catholic_mass_readings-0.1.0.tar.gz
- Upload date:
- Size: 12.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.11.11 Linux/6.8.0-1017-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a1b168d8faced0c050dc99a5ac5154f75f5ba8309ba98610b23150dafc0ecc0
|
|
| MD5 |
cc9e3d15b5b156e4a73e48b9e6412f94
|
|
| BLAKE2b-256 |
84b0a3efc0cba76d18896c912eb65a1a44a7801d794ef2885b6134915848e1cd
|
File details
Details for the file catholic_mass_readings-0.1.0-py3-none-any.whl.
File metadata
- Download URL: catholic_mass_readings-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.11.11 Linux/6.8.0-1017-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d12de0511bfd0464bc01794aab93e524ee295f44e0ee65cda1f8ccdf27eca9a
|
|
| MD5 |
9e6c5e780d2a78e9354a869bc1f48053
|
|
| BLAKE2b-256 |
f40ea35b40adcd8e267e6682d421111cdaac0ef26cf1c086e29c9e85808d8c8a
|