Skip to main content

NewTqnia Python SDK

CI PyPI Python Typing License

The official Python SDK for the NewTqnia technology news API. It includes synchronous and asynchronous clients, typed immutable models, timeouts, retries, structured errors, and safe HTML/JSON-LD rendering.

Applications displaying API content must preserve returned article URLs and visibly render the supplied Powered by NewTqnia attribution.

Installation

pip install newtqnia

Python 3.10 or newer is supported.

Quick start

from newtqnia import NewTqnia

with NewTqnia() as client:
    digest = client.news.latest(locale="en", limit=5)
    for article in digest.articles:
        print(article.title, article.url)

Arabic and category filtering:

digest = client.news.today(locale="ar", category="ai", limit=5)

The OpenAPI contract currently exposes only today and latest. The SDK deliberately does not invent search, article lookup, category listing, or pagination operations.

Async

import asyncio
from newtqnia import AsyncNewTqnia


async def main():
    async with AsyncNewTqnia() as client:
        digest = await client.news.latest(locale="en", limit=5)
        print(digest.articles)


asyncio.run(main())

Render attributed news

render_html() produces escaped, accessible, RTL-aware markup. It preserves canonical article URLs and includes visible attribution by default:

html = digest.render_html()
json_ld = digest.json_ld()

Pass attribution=False only if the page renders digest.attribution.html() visibly elsewhere. See the rendering guide.

Configuration

client = NewTqnia(
    api_key=os.getenv("NEWTQNIA_API_KEY"),
    application="editorial-dashboard",
    website="https://example.com",
    timeout=15,
    retries=3,
    headers={"X-Trace-Source": "dashboard"},
)

No key is required. Optional keys are sent as X-API-Key. Temporary network failures and HTTP 429, 500, 502, 503, and 504 responses are retried with exponential backoff; Retry-After is honored.

Errors

Catch NewTqniaError broadly or specialized ValidationError, AuthenticationError, AuthorizationError, NotFoundError, ConflictError, RateLimitError, ServerError, TimeoutError, and NetworkError. API errors expose status, request_id, code, retry_after, and body.

Development and release

python -m pytest --cov=newtqnia
ruff check .
mypy src
python -m build
twine check dist/*

PyPI releases use GitHub Actions Trusted Publishing when a v* tag is pushed. Configure the pypi environment for newtqnia/newtqnia-python in PyPI before the first release.

See CONTRIBUTING.md, SECURITY.md, and CHANGELOG.md.

Download files

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

Source Distribution

newtqnia-1.0.0.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

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

newtqnia-1.0.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file newtqnia-1.0.0.tar.gz.

File metadata

  • Download URL: newtqnia-1.0.0.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for newtqnia-1.0.0.tar.gz
Algorithm Hash digest
SHA256 fcad63814e18395bdcf87de378fe323b842967146a42792304990d0ad181a09a
MD5 02f0dcf70ce08939e31118537a27358d
BLAKE2b-256 1408864d6559fb1a8ae2cd738489008f0c823c6496bffe9614cbde678f95d198

See more details on using hashes here.

Provenance

The following attestation bundles were made for newtqnia-1.0.0.tar.gz:

Publisher: publish.yml on newtqnia/newtqnia-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file newtqnia-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: newtqnia-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for newtqnia-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 10c4b12567ab6478a9995a4d7c86b5bb7b0f47b21d47b58bb070d1af8603cad4
MD5 a383304e7ce55d97255b71b6c6b48a00
BLAKE2b-256 6f28eed27afbac1e4867202d35eb090adf490b2f1ca1fd5d9ece9e0b03bfeac8

See more details on using hashes here.

Provenance

The following attestation bundles were made for newtqnia-1.0.0-py3-none-any.whl:

Publisher: publish.yml on newtqnia/newtqnia-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

1.0.1

2 files

This release

1.0.0 This release

2 files

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