papollo
Python client for Apollo config center, with sync and async support.
from papollo import Apollo
client = Apollo("http://apollo-config:8080", "demo-app")
client.get("timeout") # "30", or None if missing
client.get("timeout", "10") # with default
client.get("db.url", namespace="database")
client.namespace("app.json")["content"] # non-properties namespace
client.refresh() # pull latest releases
from papollo import AsyncApollo
client = AsyncApollo("http://apollo-config:8080", "demo-app")
await client.get("timeout")
await client.refresh()
A client is meant to live as long as the process, usually as a module level object. It holds an
httpx connection pool, so call close() (or await client.aclose()) if you create short lived
clients. Both also work as context managers. An AsyncApollo is bound to the event loop it
is first used in.
Namespaces are fetched on first access and then served from memory. refresh() refetches every
loaded namespace, and refresh(name) also loads a namespace that was not loaded yet, which is handy
for failing fast at startup. Failures raise ApolloError and keep the previously cached config.
Other options: cluster, secret (access key), ip and label (gray release), timeout, and
http_client to bring your own httpx.Client / httpx.AsyncClient. When timeout is not set, the
httpx client's own timeout is used. ip is not detected automatically, so IP based gray release
only works when it is set.
Testing
Most tests run against a real Apollo at http://localhost:8080, the rest cover pure functions and
failures a real server can not produce on demand. The easiest server is the
quick start all in one jar with an in memory
H2 database:
SPRING_PROFILES_ACTIVE=github,database-discovery,auth SPRING_PROFILES_GROUP_GITHUB=h2 \
LOGGING_FILE_NAME=/tmp/apollo.log java -jar apollo-all-in-one.jar
uv run pytest
Tests that need Apollo are skipped when it is not reachable. Set PAPOLLO_REQUIRE_APOLLO=1 to make
them fail instead, which is what CI should do. The portal at http://localhost:8070 is used to
create apps and publish releases. Use APOLLO_CONFIG_URL, APOLLO_PORTAL_URL,
APOLLO_PORTAL_USER, APOLLO_PORTAL_PASSWORD and APOLLO_ENV to point elsewhere.
Metadata
Release files for papollo 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| papollo-0.1.0.tar.gz | 5.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| papollo-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.6 kB
Release files / papollo-0.1.0.tar.gz
| Download URL | papollo-0.1.0.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7fcafd126de4b025d083d707fc1cf648b36c4dcf0e9cf371910698355c4bdc6b
|
|
BLAKE2b-256 checksum How to use checksums |
134d82cf664cf0e65c4265116e1b6f261486bf1a1bf6810590c3dc4465004116
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.18 {"installer":{"name":"uv","version":"0.11.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":null,"id":"forky","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / papollo-0.1.0-py3-none-any.whl
| Download URL | papollo-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c6eda0e057bb37db4bdbbed37ed3a852f343c0c84995ce17d28fc6ca514c10c2
|
|
BLAKE2b-256 checksum How to use checksums |
0a0e76ab218c1480df7ccc2c4e2f6265e2d94712fd798d547c26b6b8700352ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.18 {"installer":{"name":"uv","version":"0.11.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":null,"id":"forky","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|