Skip to main content

NewsML converter (AFP news)

Project description

pyconverters_newsml

license tests codecov docs version PyPI - Python Version

Convert AFP NewsML-G2 XML feeds into pymultirole Document objects.

Supports text articles, picture captions, video descriptions, and graphic items. Extracts IPTC media topics, AFP-specific subjects (persons, organisations, locations), keywords, urgency, genre, language, and other metadata.

Installation

pip install pyconverters_newsml

Usage

The converter is registered as a pyconverters.plugins entry point under the name newsml and integrates automatically with the pymultirole plugin system.

Parameters

Parameter Type Default Description
subjects_as_metadata str "" Comma-separated subject types to extract as metadata: medtop, afpperson, afporganization, afplocation, or all.
subjects_code bool False When True, metadata values are "code:name" strings; when False, only the name is stored.
mediatopics_as_categories bool False When True, IPTC media-topic codes are added as hierarchical Category objects.
keywords_as_categories bool False When True, AFP slug keywords are added as Category objects.
natures str "text" Comma-separated list of item natures to include: text, video, picture, graphic.

Developing

Prerequisites

You will need uv and Python 3.12.

Clone the repository:

git clone https://github.com/oterrier/pyconverters_newsml
cd pyconverters_newsml

Install dependencies (including test extras):

uv sync --extra test

Running the test suite

uv run pytest

Linting

uv run ruff check .
uv run ruff format --check .

Building the documentation

uv run --extra docs sphinx-build docs docs/_build

The built documentation is available at docs/_build/index.html.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyconverters_newsml-1.6.266.tar.gz (730.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyconverters_newsml-1.6.266-py3-none-any.whl (670.1 kB view details)

Uploaded Python 3

File details

Details for the file pyconverters_newsml-1.6.266.tar.gz.

File metadata

  • Download URL: pyconverters_newsml-1.6.266.tar.gz
  • Upload date:
  • Size: 730.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.9 {"installer":{"name":"uv","version":"0.11.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pyconverters_newsml-1.6.266.tar.gz
Algorithm Hash digest
SHA256 d4d9bde0ebf33eafb6c675e7a5d1d98f999b26336303b5942dd1f6e18f91ecce
MD5 d39d2ffb9a7890b846ffcdb9087efa0e
BLAKE2b-256 cb25c57e1c00280a2e9c72f45762ce23b038a4a3f9acdc438ea2b3b1423f7103

See more details on using hashes here.

File details

Details for the file pyconverters_newsml-1.6.266-py3-none-any.whl.

File metadata

  • Download URL: pyconverters_newsml-1.6.266-py3-none-any.whl
  • Upload date:
  • Size: 670.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.9 {"installer":{"name":"uv","version":"0.11.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pyconverters_newsml-1.6.266-py3-none-any.whl
Algorithm Hash digest
SHA256 0426b832241a1ac583eb8d3713e547dafecd7556c99b9e80edd3bd7834aee92b
MD5 1c8bd664ca0922013468670112702027
BLAKE2b-256 5aaee30b6647f0ad7592d4b1bb28d6839c8d12eefe7fb35c974b1add9890404d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page