pympacds-http
HTTP client service for pympacds. Sends data over HTTP on behalf of other services and exposes it over D-Bus, with automatic retry and optional mutual TLS.
Features
- Fire-and-forget D-Bus API:
send,download, andrequesteach return a random request token immediately; the result is delivered asynchronously via therequest_completed(token, result)signal, so callers correlate a call with its outcome by token. - A single pooled
aiohttp.ClientSession(native asyncio, no thread offloading), created at startup with no network I/O and closed on shutdown. - Automatic retry of transient failures (network error, timeout, HTTP 5xx)
with exponential backoff (
retries,retry_backoff_s). - TLS verification control (
tls_verify) plus mutual TLS viatls_certfile/tls_keyfile(must be provided together). download/requestwith adownload_pathwrite the response body atomically to disk (temp file + rename) for binary/large downloads.- Runtime configuration:
[http]keys are writable via the frameworkConfigContract. - Exports the framework
HealthContract(always) andConfigContract(opt-in via[dbus] contract_config = true) alongside the HTTP contract.
Why aiohttp
The service uses aiohttp because it is asyncio
native: requests run directly on the framework's single event loop with no
thread offloading. It is isolated in this service's own package, so the core
pympacds framework keeps its zero-dependency property (the core's
httpconfprov middleware continues to use the stdlib urllib.request).
Installation
Using PIP
pip install pympacds-http
Using pip installs the Python package only — the D-Bus policy and systemd unit
are not installed. You can still run the service directly with
pympacds-http -c /etc/pympacds/http.ini, or register and enable it
system-wide with the admin script. Since there is no packaged unit, pass the
pip-installed executable via --program so the unit is generated:
sudo pympacds-admin setup # one-time: user, log dir, D-Bus policy
sudo pympacds-admin install http \
--program "$(command -v pympacds-http)" \
--config /etc/pympacds/http.ini --start
Alternatively, install the Debian package (see below), which already ships the unit and policy.
Using PPA
Debian packages are provided through launchpad ppa (dargor0/mpacds):
sudo add-apt-repository ppa:dargor0/mpacds
sudo apt update
sudo apt install python3-pympacds-http
The package installs the service system-wide (executable, systemd unit, D-Bus
policy, and the http.ini.example config) and depends on python3-pympacds.
Repository has been tested on Ubuntu (plucky, resolute, stonking) and Debian (stable, testing, unstable).
Configuration
The service reads its parameters from the [http] INI section (see
config/http.ini.example). Key options:
| Key | Default | Description |
|---|---|---|
timeout_s |
10 |
Per-request timeout |
retries |
3 |
Number of retry attempts |
retry_backoff_s |
1 |
Initial backoff (exponential) between retries |
tls_verify |
true |
Verify TLS certificates |
tls_certfile / tls_keyfile |
"" |
Client cert/key (PEM) for mutual TLS |
max_redirects |
5 |
Maximum redirects to follow |
default_url |
"" |
Target URL used by send() (empty = send() fails) |
default_method |
POST |
Default HTTP method used by send() |
default_headers |
"" |
Default headers (JSON object) used by send() |
Run with:
pympacds-http -c /etc/pympacds/http.ini
D-Bus API
Interface org.pympacds.HTTP at object path /org/pympacds/http:
| Member | Type | Description |
|---|---|---|
send(payload) |
send(s) -> s |
Send with default url/method/headers; returns a token |
download(payload, download_path) |
download(ss) -> s |
Like send, but saves the body to download_path |
request(method, url, headers, body, download_path) |
request(sssss) -> s |
Explicit request; empty download_path = return body |
request_completed(token, result) |
signal (ss) |
Emitted on completion; carries the token and JSON result |
All sends are fire-and-forget: the method returns immediately with a
randomized token, the request runs asynchronously, and request_completed is
emitted with the full JSON outcome:
{
"status_code": 200,
"url": "https://example.com/api",
"elapsed_ms": 123,
"body": "...",
"download_path": null,
"bytes_written": null,
"error": null
}
The framework HealthContract (at .../health) and ConfigContract
([dbus] contract_config = true) are also exported.
Metadata
Release files for pympacds-http 0.1.3
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 | Actions |
|---|---|---|---|---|
| pympacds_http-0.1.3.tar.gz | 15.5 kB | Without provenance | Details for pympacds_http-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pympacds_http-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for pympacds_http-0.1.3-py3-none-any.whl |
Total release size: 24.0 kB
Release files / pympacds_http-0.1.3.tar.gz
| Download URL | pympacds_http-0.1.3.tar.gz |
|---|---|
| Size | 15.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aa15adb0e69f60d97514e41bdf8dbe4dd0aabb9996bdcb5f2cc84e00d9192f02
|
|
BLAKE2b-256 checksum How to use checksums |
173783e265bcaba12510c5226b8327769492783dd82425f5517aeaa00ac4666c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Release files / pympacds_http-0.1.3-py3-none-any.whl
| Download URL | pympacds_http-0.1.3-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
da77ed88b0fb233e5775dc671848d3982cbafc7802ff77d5ffb29b691a8a588a
|
|
BLAKE2b-256 checksum How to use checksums |
cf1aa01d0e624446a046fc851e1840c4f9fe2b68d1e59057ed500e1ace7803d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Security for pympacds-http 0.1.3
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.