HTTP workflow orchestration engine.
Project description
httporchestrator
httporchestrator is a small library for explicit multi-step HTTP flows with a single shared state.
Public API
Flowdefines a flow.RequestStepdefines one HTTP request step.ConditionalStepconditionally runs a step.RepeatableSteprepeats a step run_while a predicate stays true.CallFlowruns another flow and exports selected state back to the parent.Flow.run()returns aWorkflowRun.
Quick Start
from httporchestrator import Flow, RequestStep
flow = Flow(
name="echo test",
base_url="https://postman-echo.com",
steps=(
RequestStep("load token")
.get("/get")
.params(foo="bar")
.capture("saved_foo", lambda response, state: response.json()["args"]["foo"])
.check(lambda response, state: response.status_code == 200, "request should succeed"),
RequestStep("post extracted value")
.post("/post")
.json(lambda state: {"foo": state["saved_foo"]})
.check(
lambda response, state: response.json()["json"]["foo"] == "bar",
"posted payload should contain the captured value",
),
),
).export(["saved_foo"])
run = flow.run()
assert run.success
assert run.exported["saved_foo"] == "bar"
Step Phases
RequestStep steps execute in a fixed order:
- Step-local
.state(...)values are resolved against the current flow state. .before(fn)callbacks can update request-time state.- RequestStep URL, headers, params, body, and JSON are resolved.
- The HTTP request is sent.
.capture(...),.after(fn), and.check(...)run in order.- The produced state updates are merged back into the flow state.
Callback contracts:
.before(fn)takesstateand must return a mapping orNone..after(fn)takesresponse, stateand must return a mapping orNone..capture(name, fn)saves one named value into state..check(fn, message="")raisesValidationFailurewhen the assertion returnsFalseor throws.
Nested and Conditional Flows
from httporchestrator import CallFlow, Flow, RequestStep, ConditionalStep
child = Flow(
name="health check",
base_url="https://postman-echo.com",
steps=(
RequestStep("ping")
.get("/get")
.capture("ok", lambda response, state: response.status_code == 200)
.check(lambda response, state: response.status_code == 200, "health check failed"),
),
).export(["ok"])
parent = Flow(
name="parent",
steps=(
CallFlow("run health check").use(child, flow_name="nested health check").export("ok"),
ConditionalStep(RequestStep("optional ping").get("https://postman-echo.com/get")).run_when(lambda state: state["ok"] is True),
),
).export(["ok"])
Runtime Model
WorkflowRun.summarycontains the overall result.WorkflowRun.session_variablescontains the final flow state.WorkflowRun.exportedcontains only the configured exported values.StepResult.state_updatescontains the state written by that step.
Fetchers
Use create_fetcher() for provider auto-detection:
from fetchers.fetcher_registry import create_fetcher
from fetchers.utils import Mode
fetcher = create_fetcher(
"https://wetransfer.com/downloads/TRANSFER_ID/SECURITY_HASH",
mode=Mode.INFO,
save_path="downloads",
)
run = fetcher.run()
print(run.summary.success)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file httporchestrator-1.0.2.tar.gz.
File metadata
- Download URL: httporchestrator-1.0.2.tar.gz
- Upload date:
- Size: 19.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a7e2107364f922e25e828dc35f8abe3b2c49e1e5b38ed13116bf4c285a2a87f
|
|
| MD5 |
03d0e52a8c20e1d024b0fb5fa176aa71
|
|
| BLAKE2b-256 |
4c45b34acb0083ae48ff9e70896aea6064843f821ca74379c770c8bfd8e53a88
|
Provenance
The following attestation bundles were made for httporchestrator-1.0.2.tar.gz:
Publisher:
release.yml on shahar99s/httporchestrator.py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
httporchestrator-1.0.2.tar.gz -
Subject digest:
4a7e2107364f922e25e828dc35f8abe3b2c49e1e5b38ed13116bf4c285a2a87f - Sigstore transparency entry: 1614676464
- Sigstore integration time:
-
Permalink:
shahar99s/httporchestrator.py@e5be40841f55b7b6142d6dd278e9af529e0bb1e6 -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/shahar99s
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e5be40841f55b7b6142d6dd278e9af529e0bb1e6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file httporchestrator-1.0.2-py3-none-any.whl.
File metadata
- Download URL: httporchestrator-1.0.2-py3-none-any.whl
- Upload date:
- Size: 25.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f495544e629334b5aa2c02965a375e9301e9ccc73e78948731725a3fe9cc69c4
|
|
| MD5 |
e913e9fcb71b95396759b9105a461f75
|
|
| BLAKE2b-256 |
601bbd6ebcc49686f46168cd0da2e13843426fb876ba4f08b1d62575ffcd7718
|
Provenance
The following attestation bundles were made for httporchestrator-1.0.2-py3-none-any.whl:
Publisher:
release.yml on shahar99s/httporchestrator.py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
httporchestrator-1.0.2-py3-none-any.whl -
Subject digest:
f495544e629334b5aa2c02965a375e9301e9ccc73e78948731725a3fe9cc69c4 - Sigstore transparency entry: 1614676469
- Sigstore integration time:
-
Permalink:
shahar99s/httporchestrator.py@e5be40841f55b7b6142d6dd278e9af529e0bb1e6 -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/shahar99s
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e5be40841f55b7b6142d6dd278e9af529e0bb1e6 -
Trigger Event:
push
-
Statement type: