{"id":17345065,"url":"https://github.com/sveetch/django-feedparser","last_synced_at":"2025-04-14T20:31:29.077Z","repository":{"id":57420049,"uuid":"47497085","full_name":"sveetch/django-feedparser","owner":"sveetch","description":"A Django app using 'feedparser' to fetch and parse a feed to render it from a template","archived":false,"fork":false,"pushed_at":"2017-06-07T14:13:50.000Z","size":15,"stargazers_count":3,"open_issues_count":2,"forks_count":10,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-12T02:24:34.273Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sveetch.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-06T13:08:12.000Z","updated_at":"2019-04-30T08:54:08.000Z","dependencies_parsed_at":"2022-09-03T21:12:39.758Z","dependency_job_id":null,"html_url":"https://github.com/sveetch/django-feedparser","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sveetch%2Fdjango-feedparser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sveetch%2Fdjango-feedparser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sveetch%2Fdjango-feedparser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sveetch%2Fdjango-feedparser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sveetch","download_url":"https://codeload.github.com/sveetch/django-feedparser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248955260,"owners_count":21189029,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-15T16:29:12.798Z","updated_at":"2025-04-14T20:31:29.057Z","avatar_url":"https://github.com/sveetch.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":".. _six: https://pypi.python.org/pypi/six\n.. _Django: https://www.djangoproject.com/\n.. _feedparser: https://github.com/kurtmckee/feedparser\n.. _requests: http://docs.python-requests.org/\n.. _DjangoCMS: https://www.django-cms.org\n.. _cmsplugin_feedparser: https://github.com/sveetch/cmsplugin-feedparser\n\n=================\ndjango-feedparser\n=================\n\nA `Django`_ app using `feedparser`_ to fetch and parse a feed to render it from a template. \n\nIt is not a Feed agregator since it manage feeds one by one.\n\n* `requests`_ is used to fetch feeds;\n* `feedparser`_ is used to parse feeds;\n* Django cache is used to avoid fetching again the feed each time;\n* Basic feed renderers just parse the feed without modifying anything but you can extend it to implement your post-process formatting;\n* Once the feed has been fetched, it can be displayed through a template. Default template is really basic and you should eventually override it or create another one to fit to your feed structure/format;\n* A `DjangoCMS`_ plugin is available on `cmsplugin_feedparser`_;\n\nLinks\n*****\n\n* Download his `PyPi package \u003chttps://pypi.python.org/pypi/django-feedparser\u003e`_;\n* Clone it on his `repository \u003chttps://github.com/sveetch/django-feedparser\u003e`_;\n\nRequires\n********\n\n* `six`_;\n* `Django`_ \u003e= 1.4;\n* `requests`_ \u003e= 2.7.0',\n* `feedparser`_ \u003e= 5.1.3',\n\nInstall\n*******\n\nFirst install the package: ::\n\n    pip install django-feedparser\n\nAdd it to your installed Django apps in settings: ::\n\n    INSTALLED_APPS = (\n        ...\n        'django_feedparser',\n        ...\n    )\n\nThen import its settings: ::\n\n    from django_feedparser.settings import *\n\nAnd finally see about `Available settings`_ you can override.\n\nUsage\n*****\n\nRenderers\n---------\n\nThere is actually two basic renderer available:\n\nbasic-xml\n    Just the basic renderer, parsing an XML feed and return result given by `feedparser`.\n    \n    Don't do any special formatting.\nbasic-json\n    Like ``basic-xml`` but for a JSON feed, obviously don't use `feedparser` but \n    the ``json`` builtin from Python and return the loaded object.\n\nFinally, remember than your renderer have to be compatible with the used template and vice-versa.\n\nViews\n-----\n\nThere is a mixin ``django_feedparser.views.FeedFetchMixin`` you can inherit from your views to exploit a feed.\n\nAnd there is a basic view ``django_feedparser.views.FeedView`` that inherits from mixin ``FeedFetchMixin`` to demonstrate its usage. However the basic view is usable as it if it meets your needing, if so you just have to use it directly in your urls like ``django.views.generic.base.TemplateView``: ::\n    \n    from django.conf.urls import *\n\n    from .views import FeedView\n\n    urlpatterns = patterns('',\n        ...\n        url(r'^myfeed/$', FeedView.as_view(feed_url=\"http://localhost/myfeed.xml\"), name=\"myfeed\"),\n        ...\n    )\n\n.. NOTE::\n   Although the app contains an 'urls.py', it's mainly intended for debugging purpose, you should not mount it in your project urls.\n\nTemplate tags\n-------------\n\nMore common way is to use the template tag to include rendered feed in your templates.\n\nBasic sample: ::\n\n    {% load feedparser_tags %}\n    {% feedparser_render 'http://localhost/sample.xml' %}\n\nOr with all accepted arguments: ::\n\n    {% feedparser_render 'http://localhost/sample.xml' renderer='CustomRenderer' template='foo/custom.html' expiration=3600 %}\n\n\nAvailable settings\n******************\n\nFEED_RENDERER_DEFAULT_TEMPLATE\n    Path to the default renderer template.\n    \n    **Default value**: ``'django_feedparser/basic_feed_renderer.html'``\n\nFEED_CACHE_KEY\n    Feed cache key template string.\n    \n    **Default value**: ``'feedparser_feed_{id}_{expire}'``\n\nFEED_TIMEOUT\n    Timeout until feed response, in seconds.\n    \n    **Default value**: ``5``\n\nFEED_BOZO_ACCEPT\n    Wether we accept (``True``) badly formatted xml feed or not (``False``).\n    \n    **Default value**: ``True``\n\nFEED_SAFE_FETCHING\n    Wether fetching a feed throw an exception (False) or not (True).\n    \n    Bad http status, request errors and timeout error are silently catched when safe fetching is enabled.\n    \n    **Default value**: ``False``\n\nFEED_RENDER_ENGINES\n    A Python dictionnary for available renderer engines, where the key is the shortcut \n    engine name and the value is a valid Python path to the renderer class.\n    \n    **Default value**: ::\n    \n        {\n            'basic-xml': 'django_feedparser.renderer.FeedBasicRenderer',\n            'basic-json': 'django_feedparser.renderer.FeedBasicRenderer',\n        }\n\nDEFAULT_FEED_RENDER_ENGINE\n    The default renderer engine name to use when no one is given.\n    \n    **Default value**: ``basic-xml``\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsveetch%2Fdjango-feedparser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsveetch%2Fdjango-feedparser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsveetch%2Fdjango-feedparser/lists"}