<commit_before>from datetime import datetime
from xml.utils import iso8601
import feedparser

class RSSModuleServiceStatusProvider(object):
    def __init__(self, name, slug, url):
        self.name, self.slug, self.url = name, slug, url

    def parse_date(self, s):
        try:
            return datetime.fromtimestamp(iso8601.parse(s))
        except (TypeError, ValueError):
            return None

    def safe_parse(self, f, s):
        try:
            return f(s)
        except (TypeError, ValueError):
            return None

    def get_status(self):
        services_feed = feedparser.parse(self.url)
        lastBuildDate = self.parse_date(services_feed.entries[0].get('ss_lastchecked'))
        
        services = []
        for service in services_feed.entries:
            services.append({
                'source': self.slug,<commit_msg>RSS Service Status Provider no longer raises an exception when no entries are present; instead it grabs the Last-Modified header.<commit_after>from datetime import datetime
from xml.utils import iso8601
from molly.utils.date_parsing import rfc_2822_datetime
import feedparser

class RSSModuleServiceStatusProvider(object):
    def __init__(self, name, slug, url):
        self.name, self.slug, self.url = name, slug, url

    def parse_date(self, s):
        try:
            return datetime.fromtimestamp(iso8601.parse(s))
        except (TypeError, ValueError):
            return None

    def safe_parse(self, f, s):
        try:
            return f(s)
        except (TypeError, ValueError):
            return None

    def get_status(self):
        services_feed = feedparser.parse(self.url)
        
        try:
            lastBuildDate = self.parse_date(services_feed.entries[0].get('ss_lastchecked'))
        except IndexError, e:
            try:
                lastBuildDate = rfc_2822_datetime(services_feed.headers['last-modified'])
            except Exception, e:
                lastBuildDate = None
            
        
        services = []
        for service in services_feed.entries:
            services.append({
                'source': self.slug,
{'fraction_non_alphanumeric': 0.085634066448292, 'fraction_numerical': 0.012166588675713618, 'mean_word_length': 2.2791411042944785, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '252473', 'n_tokens_mistral': 601, 'n_tokens_neox': 576, 'n_words': 154}