Skip to main content

listparser

Parse OPML subscription lists in Python.


If you’re building a feed reader and you need to parse OPML subscription lists, you’ve come to the right place!

listparser makes it easy to parse and use subscription lists in multiple formats. It supports OPML, RDF+FOAF, and the iGoogle exported settings format, and runs on Python 3.8+ and on PyPy 3.8.

Usage

>>> import listparser
>>> result = listparser.parse(open("feeds.opml").read())

A dictionary will be returned with several keys:

  • meta: a dictionary of information about the subscription list

  • feeds: a list of feeds

  • lists: a list of subscription lists

  • version: a format identifier like “opml2”

  • bozo: True if there is a problem with the list, False otherwise

  • bozo_exception: (if bozo is 1) a description of the problem

For convenience, the result dictionary supports attribute access for its keys.

Continuing the example:

>>> result.meta.title
'listparser project feeds'
>>> len(result.feeds)
2
>>> result.feeds[0].title, result.feeds[0].url
('listparser blog', 'https://kurtmckee.org/tag/listparser')

More extensive documentation is available in the docs/ directory and online.

Bugs

There are going to be bugs. The best way to handle them will be to isolate the simplest possible document that susses out the bug, add that document as a test case, and then find and fix the problem.

…you can also just report the bug and leave it to someone else to fix the problem, but that won’t be as much fun for you!

Bugs can be reported on GitHub.

Git workflow

listparser basically follows the git-flow methodology:

  • Features and changes are developed in branches off the main branch. They merge back into the main branch.

  • Feature releases branch off the main branch. The project metadata is updated (like the version and copyright years), and then the release branch merges into the releases branch. The releases branch is then tagged, and then it is merged back into main.

  • Hotfixes branch off the releases branch. As with feature releases, the project metadata is updated, the hotfix branch merges back into the releases branch, which is then tagged and merged back into main.

Development

To set up a development environment, follow these steps at a command line:

# Set up a virtual environment.
python -m venv .venv

# Activate the virtual environment in Linux:
. .venv/bin/activate

# ...or in Windows Powershell:
& .venv/Scripts/Activate.ps1

# Install dependencies.
python -m pip install -U pip setuptools wheel
python -m pip install poetry pre-commit tox scriv
poetry install --all-extras

# Enable pre-commit.
pre-commit install

# Run the unit tests.
tox

When submitting a PR, be sure to create and edit a changelog fragment.

scriv create

The changelog fragment will be created in the changelog.d/ directory. Edit the file to describe the changes you’ve made.

Release files for listparser 0.20

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for listparser 0.20
File Size Uploaded
listparser-0.20.tar.gz 12.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for listparser 0.20
File Interpreter ABI Platform
listparser-0.20-py3-none-any.whl Python 3 none any Details

Total release size: 26.6 kB

Release files / listparser-0.20.tar.gz

Download URL listparser-0.20.tar.gz
Size 12.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0dda5b41ca9531fc3c438eb4abf4d8a7cf03ef050d196875993e897a66c1f885
BLAKE2b-256 checksum
How to use checksums
beeed9f02600955ca34baf73e824d64b181b412745ed448a0ad1a92cef81115b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.8

Release files / listparser-0.20-py3-none-any.whl

Download URL listparser-0.20-py3-none-any.whl
Size 14.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5daae9895b75191a77b14f5b8eabf7a63a4ca440f215d9bd8d8e5a2eccde02ce
BLAKE2b-256 checksum
How to use checksums
c927bd96818acce8ed1909dff29817096016f5e958ef646a377b34d55afa23b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.8

Release history Release notifications | RSS feed

This release

0.20 This release

2 release files

0.19

2 release files

0.18

3 release files

0.17

3 release files

0.16

3 release files

0.15

1 release file

0.14

1 release file

0.13

1 release file

0.12

1 release file

0.11

1 release file

0.10

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page