Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
django-rss-xml-parser
Advanced tools
This parser is intended for RSS/XML that does not communicate the standard rfc5005
This parse is intended for XML / RSS, which does not conform to the standard: https://tools.ietf.org/html/rfc5005
Use https://pypi.python.org/pypi/feedparser for standard RSS
pip install django-rss_xml-parser
add to settings
INSTALLED_APPS = [
...
'django_rss_xml',
...
]
afisha = {
"elements": "event",
"items_to": {"id__attr": "event_id", "title": "title", "text": "text"}
}
yandex = {
"elements": "item",
"items_to": {"title": "title", "description": "text"}
}
kassir = {"elements": "item"}
...
from django.db import models
from django.utils.translation import ugettext as _
from django.utils.timezone import now
class Tags(models.Model):
tag = models.CharField(max_length=50, verbose_name=_("Tag"))
class RssModel(models.Model):
event_id = models.IntegerField(verbose_name=_("event ID"), null=True)
title = models.CharField(max_length=550, verbose_name=_("Title"), null=True)
text = models.TextField(verbose_name=_("Description"), null=True)
time = models.DateTimeField(verbose_name=_("Time and Date"), default=now, blank=True)
tags = models.ForeignKey(Tags, on_delete=models.CASCADE, verbose_name=_('Tags'), null=True, blank=True)
rss_rules = {"uri": 'rss/data/afisha.xml', "rule": afisha}
OR
rss_rules = {"uri": 'https://news.yandex.ru/auto.rss', "rule": yandex}
example:
from django.views.generic import TemplateView
from .rss_mapper import kassir, afisha, yandex
from django_rss_xml.rss_parser import RSS
from .models import RssModel
class RSSView(TemplateView, RSS):
template_name = "rss/rss.html"
rss_rules = {"uri": 'rss/data/afisha.xml', "rule": afisha}
def get_context_data(self, **kwargs):
context = super(RSSView, self).get_context_data(**kwargs)
context['rss_obj'] = self.rss_to_object()
context['rss_m'] = self.rss_to_model(RssModel)
return context
python manage.py test django_rss_xml
FAQs
This parser is intended for RSS/XML that does not communicate the standard rfc5005
We found that django-rss-xml-parser demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.