Created
March 16, 2021 18:56
-
-
Save blackknight36/14f496415fab937cfb5a9302d3441dfd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import requests | |
import string, sys, time, urllib | |
import xml.etree.ElementTree as et | |
def read_feed(url): | |
r = requests.get(url) | |
root = et.fromstring(r.text) | |
date = time.strftime("%B %d, %Y", time.localtime()) | |
#print(root.find('date').text) | |
print(date) | |
print(root.find('lectionarytitle').text) | |
print(root.find('fasting').text) | |
print("<ul class='saints'>") | |
for saintfeast in root.findall('saintsfeasts/saintfeast'): | |
title = saintfeast.find('title').text | |
link = saintfeast.find('publicurl').text | |
print("<li><a href='{link}'>{title}</a></li>".format(link=link, title=title)) | |
print('</ul>') | |
print("<ul class='readings'>") | |
for reading in root.findall('readings/reading'): | |
link = reading.find('publicurl').text | |
title = reading.find('translation/title').text | |
print("<li><a href='{link}'>{title}</a></li>".format(link=link, title=title)) | |
print('</ul>') | |
print("Content-type: text/plain\n") | |
read_feed('http://onlinechapel.goarch.org/daily.asp') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment