NewTqnia Python SDK
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.
Metadata
Release files for newtqnia 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| newtqnia-1.0.1.tar.gz | 10.5 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| newtqnia-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.7 kB
Release files / newtqnia-1.0.1.tar.gz
| Download URL | newtqnia-1.0.1.tar.gz |
|---|---|
| Size | 10.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c014853d118fd14916d7371cbfce32723640d833e01af25b18db7d332fb37687
|
|
BLAKE2b-256 checksum How to use checksums |
dc59c74f352292d0feb46758653c5ca8a36f36e34f5a13bb52b43375f0c80d47
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 21, 2026.
Transparency logRelease files / newtqnia-1.0.1-py3-none-any.whl
| Download URL | newtqnia-1.0.1-py3-none-any.whl |
|---|---|
| Size | 9.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
34218c5989cac2ed7d32b2a0d9580f2f803f3d47b200ad5af6c0a91d098ade9a
|
|
BLAKE2b-256 checksum How to use checksums |
4f2ffc5e2a49f1cf204699677ad3bca768d6db1c32ca77407fa1befda5072add
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 21, 2026.
Transparency logSecurity for newtqnia 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for newtqnia-1.0.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 21, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.