Skip to content

Instantly share code, notes, and snippets.

@R4wm
Last active May 4, 2021
Embed
What would you like to do?
super simple script to get daily reading ranges
#!/usr/bin/env python3
import requests
URL = 'https://mintz5.duckdns.org/bible/daily'
###############
# get_portion #
###############
def get_portion(a_testament: str) -> str:
a_testament = a_testament.lower()
# Form the string
print("---{} Reading---".format(a_testament.upper()))
l_url = '/'.join([URL, a_testament])
l_daily_read = requests.get(l_url).json()
return '{book} {chapter}:{verse} - {end_book} {end_chapter}:{end_verse}'.format(book=l_daily_read[0]['Book'],
chapter=l_daily_read[0]['Chapter'],
verse=l_daily_read[0]['Verse'],
end_book=l_daily_read[-1]['Book'],
end_chapter=l_daily_read[-1]['Chapter'],
end_verse=l_daily_read[-1]['Verse'])
########
# main #
########
if __name__ == '__main__':
print(get_portion('ot'))
print(get_portion('nt'))
@R4wm
Copy link
Author

R4wm commented Sep 17, 2020

Thu 17 Sep 2020 11:46:07 AM PDT
:$ ./daily_reading.py
---Old Testament Reading---
PSALMS 148:9 - PROVERBS 2:10
---Old Testament Reading---
GALATIANS 3:23 - GALATIANS 4:17
:$ 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment