Skip to content

Instantly share code, notes, and snippets.

@blackknight36
Created March 16, 2021 18:56
Show Gist options
  • Save blackknight36/14f496415fab937cfb5a9302d3441dfd to your computer and use it in GitHub Desktop.
Save blackknight36/14f496415fab937cfb5a9302d3441dfd to your computer and use it in GitHub Desktop.
#!/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