Registry / http-networking / feedparser

feedparser

JSON →
library6.0.14pypypi✓ verified 26d ago

Feedparser is a Python library for downloading and parsing syndicated feeds, including RSS (0.9x, 1.0, 2.0), Atom (0.3, 1.0), CDF, and JSON feeds. It aims to normalize various feed types and versions into a consistent Python dictionary structure, simplifying feed processing. The current stable version is 6.0.12, and the project maintains an active release cadence with regular updates and fixes.

pip install feedparser
INSTALL
IMPORT
SIG · FEEDPARSER
F
feedparser
http-networkingpythonv6.0.14
Install
1.8s avg
Import
207ms
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v6.0.14 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.216s · 18.4MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.8s · import 0.198s · 19MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

feedparser
import feedparser

Parses a given feed URL and prints the feed title, the title of the first entry, and its link. It handles both RSS and Atom feeds, normalizing their structures.

import feedparser import os # Replace with a real RSS/Atom feed URL feed_url = os.environ.get('FEED_URL', 'http://feedparser.org/docs/examples/atom10.xml') d = feedparser.parse(feed_url) print(f"Feed Title: {d.feed.title}") if d.entries: first_entry = d.entries[0] print(f"First Entry Title: {first_entry.title}") print(f"First Entry Link: {first_entry.link}") if hasattr(first_entry, 'published_parsed'): print(f"First Entry Published: {first_entry.published_parsed}")
Debug
Known issues
breakingThe `sanitize_html` and `resolve_relative_uris` flags, which were global module attributes in `feedparser` 5.x, must now be passed directly as arguments to the `feedparser.parse()` function in version 6.x.
fix
Update calls from `feedparser.SANITIZE_HTML = True; feedparser.parse(...)` to `feedparser.parse(..., sanitize_html=True)`.
affects: 5.x to 6.x
gotchaOlder versions of `feedparser` 6.x (prior to 6.0.12) could crash with an `AssertionError` on Python 3.10+ when encountering malformed CDATA sections in feeds.
fix
Upgrade to `feedparser` version 6.0.12 or higher to resolve the `AssertionError` crash with Python 3.10+.
affects: 6.0.0 - 6.0.11
deprecated`feedparser` 6.0.10 and earlier versions relied on Python's deprecated `cgi` module, which is slated for removal in Python 3.13. This could lead to `DeprecationWarning` messages on newer Python interpreters.
fix
Upgrade to `feedparser` version 6.0.11 or higher to avoid deprecation warnings related to the `cgi` module.
affects: 6.0.0 - 6.0.10
gotchaThe internal HTTP fetching mechanism of `feedparser` (which uses `urllib` by default) does not include a built-in timeout, potentially causing applications to hang indefinitely when a feed server is unresponsive.
fix
Implement a custom timeout mechanism by monkey-patching `feedparser.api._open_resource` to use an HTTP client library like `requests` with explicit timeout parameters. Example: `feedparser.api._open_resource = lambda *args, **kwargs: requests.get(args[0], headers=headers, timeout=5).content`.
affects: All versions
breaking`feedparser` version 6.x officially dropped support for Python 2. Early 6.0.x releases had issues where `pip` might incorrectly install them on Python 2 due to incorrect wheel metadata.
fix
Ensure you are running Python 3.6 or later when using `feedparser` 6.x. If targeting Python 2, use `feedparser` 5.x.
affects: 6.0.0 and newer
gotchaWhen a parsed feed does not contain a top-level `<title>` element, accessing `d.feed.title` will raise an `AttributeError` (originating from a `KeyError`). `feedparser` does not automatically provide a default empty string or `None` for missing attributes like 'title' via direct attribute access.
fix
Access feed elements defensively using `d.feed.get('title')` or check for existence with `if 'title' in d.feed:` before attempting direct attribute access like `d.feed.title`.
affects: All versions
gotchaDirectly accessing feed or entry attributes (e.g., `d.feed.title`, `d.entries[0].link`) without prior validation can raise an `AttributeError` if the corresponding element is missing in the parsed RSS/Atom feed. This often occurs with malformed, incomplete, or non-standard feeds.
fix
Use the `dict.get()` method or `hasattr()` to safely access potentially missing attributes. For example, `title = d.feed.get('title', 'Default Title')` or `if hasattr(d.feed, 'title'): print(d.feed.title)`.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'feedparser'
The 'feedparser' library is not installed in the Python environment being used, or the Python interpreter cannot find it.
fix
Install the library using pip: `pip install feedparser` or `python -m pip install feedparser` to ensure it's installed for the correct Python interpreter.
KeyError: 'title' (or other keys like 'summary', 'link', 'entries')
The accessed key (e.g., 'title') does not exist in the specific feed, entry, or dictionary structure returned by `feedparser` because feed structures vary widely.
fix
Always check for the existence of keys using `.get()` with a default value, or wrap access in a `try-except KeyError` block, or print `d.keys()` and `d.entries[0].keys()` to inspect the actual available keys.
SSL: CERTIFICATE_VERIFY_FAILED
Python's `urllib` (which `feedparser` uses internally for HTTP requests) is unable to verify the SSL certificate of the feed's server, often due to an outdated `certifi` package, missing system certificates, or specific network configurations.
fix
Update the `certifi` package (`pip install --upgrade certifi`), ensure your system's root certificates are up-to-date, or, as a temporary workaround in development (not recommended for production due to security implications), disable SSL verification by setting `ssl._create_default_https_context = ssl._create_unverified_context` (Python 3.4+).
feedparser.parse() returns no entries or empty list for 'entries'
The feed URL might be invalid, the feed content might be malformed, the server might be blocking the request, or the feed has no actual entries. `feedparser` might still successfully parse the overall feed structure but find no valid entries.
fix
Check `d.status` for HTTP errors (e.g., 404, 500). Inspect `d.bozo` and `d.bozo_exception` for parsing errors in malformed feeds. Verify the URL is correct and accessible. If network issues are suspected, try using a library like `requests` to fetch the content first and then pass `response.content` to `feedparser.parse()`.
Upgrade
Version history
6.0.14latest on PyPI · released Jul 30, 2026
Audit
Dependencies
sgmllib3koptionalRequired for HTML sanitization and relative link resolution features, as it was removed from Python's standard library in Python 3. While not explicitly listed as a direct runtime dependency on PyPI, it is used for these specific parsing capabilities.
Agent activity
48 hits · last 30 days
node
46
Amazon
1
Resources
feedparser — pip install feedparser · libregistry