Skip to content

Instantly share code, notes, and snippets.

@arhouati
Created February 2, 2021 22:40
Show Gist options
  • Select an option

  • Save arhouati/a62f9a2f0a62ef0ff3de901b6aa2df6c to your computer and use it in GitHub Desktop.

Select an option

Save arhouati/a62f9a2f0a62ef0ff3de901b6aa2df6c to your computer and use it in GitHub Desktop.
import xmltodict
from urllib.request import urlopen
class RssFeed(threading.Thread):
def __init__(self, url):
threading.Thread.__init__(self)
self.url = url
name = "undefined"
items = []
def set_name(self, text):
self.name = text
def run(self):
self.start = time.time()
data = urlopen(self.url).read().decode('utf-8')
self.d = xmltodict.parse(data)
self.end = time.time()
self.diff = self.end - self.start
if __debug__:
logging.info("{:.3f}".format(self.diff) + " s\t" + self.url)
self.items = self.d['rss']['channel']['item']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment