epochal-api
Python client for the Epochal API. Its one module today is the Time Portal: web search, web fetch and sandboxes held to a past instant, so nothing published or crawled after it is used.
pip install epochal-api
export EPOCHAL_API_KEY=...
Requires Python 3.11.4 or later. Create an API key at https://console.epochal.com/keys;
EPOCHAL_BASE_URL overrides the API address (default https://api.epochal.com). API docs:
https://docs.epochal.com.
from epochal.api import Client
from epochal.api.time_portal import PageStatus
with Client() as client:
portal = client.time_portal("2025-03-12")
found = portal.search("fed rate decision")
for hit in found.results:
print(hit.title, hit.url)
if hit.entity:
print(" ", hit.entity.type, hit.entity.typed)
page = portal.fetch("https://example.com/news")
print(page.content if page.status is PageStatus.SUCCESS else page.page_error)
AsyncClient has the same methods as coroutines:
import asyncio
from epochal.api import AsyncClient
async def main() -> None:
async with AsyncClient() as client:
found = await client.time_portal("2025-03-12").search("fed rate decision")
print(len(found.results))
asyncio.run(main())
- Modules:
Clientholds the key, connections and retries; each API module is a handle from it.client.time_portal(as_of)is aTimePortalheld toas_of(AsyncTimePortalon anAsyncClient), and its types are inepochal.api.time_portal. Search, fetch, page andcreate_sandboxare held to the portal'sas_of; the other calls name a box by id, and it keeps its own instant. - Methods of
TimePortal:search,fetch,page(the archived page itself; a page that could not be read is returned withstatusPageStatus.ERRORand the site's reason inpage_error, not raised), and the sandbox callscreate_sandbox,get_sandbox,list_sandboxes,terminate_sandbox,start_exec,read_exec_output,send_exec_input,stat_file,list_files,read_file,write_file,remove_file. - Entities: a
searchresult that is ahttps://world.epochal.com/page carries its entity inresults[i].entity(Noneon every other result), andfetchreturns such a page's entity inentity.SearchResponse.entitiesis reserved; entities come onresults[i].entity.entity.propertiesis the JSON as sent;entity.typedreads it into one class per public type (organization, person, place, crypto, weather) fromepochal.api.entities, orUnknownPropertieswith the JSON for a type, or aschema_versionof one, this version doesn't model. Their enums are open: a new value reads as thestrsent. - Instants are an aware
datetime, an ISO 8601 string, or a day (adateor"YYYY-MM-DD"). As anas_of, a day means its last second, 23:59:59 UTC, as the API reads it. A datetime without a time zone raisesInvalidArgumentErrorfromtime_portal, before any request. - Retries: a dropped connection, a timeout, or a 408, 429, 500, 502, 503, 504 or 520-524 is
retried up to
max_retriestimes (default 5), with jittered exponential backoff that honorsRetry-After, sleeping at most 60 s in all. Search, fetch and page are billed and can't be deduplicated, so they are retried only on 408, 429 and 503, when the server did nothing. Creates and command starts carry anIdempotency-Key, so a retry never makes a second sandbox or runs a command twice. - Newer servers:
categoriestakes any name, andsearchandfetchtakeextra_body=for fields this version doesn't model, sent as given, so a new search or fetch option needs no new release. - Connections are pooled per client: share one client and close it when done. Pass
http_client=to bring your ownhttpxclient (proxies, custom transports). - Errors all derive from
EpochalError:APIError(withstatus,kind,request_id,retry_after),TransportError,DecodeError,InvalidArgumentErrorandMissingApiKeyError. Each says whether it isretryable.
To run commands and move files in sandboxes, use
epochal-sandbox, which is
built on this package.
Metadata
Release files for epochal-api 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 | Provenance | Actions |
|---|---|---|---|---|
| epochal_api-0.1.0.tar.gz | 43.0 kB | Without provenance | Details for epochal_api-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| epochal_api-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for epochal_api-0.1.0-py3-none-any.whl |
Total release size: 84.6 kB
Release files / epochal_api-0.1.0.tar.gz
| Download URL | epochal_api-0.1.0.tar.gz |
|---|---|
| Size | 43.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
71c6e149845c22afb704fe715eefb205b03feab1edfdf445a22fba5267050598
|
|
BLAKE2b-256 checksum How to use checksums |
ae0f9558d16223e9141119eaf4ee47e44aef0a5c3ed9d9da93992069b04bc480
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / epochal_api-0.1.0-py3-none-any.whl
| Download URL | epochal_api-0.1.0-py3-none-any.whl |
|---|---|
| Size | 41.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
12a86f5431b5bf1c0996e1f337518677c1231f795fa9ccc4e6a59292028bb2e1
|
|
BLAKE2b-256 checksum How to use checksums |
cde65ed9efea3708955523b6aa4dc84173db9765aef41d83647ee2364b2536ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for epochal-api 0.1.0
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.