Different pipes. One standard.

Type to search this site.

Search runs in your browser against a static index built with this site (Pagefind). Nothing you type is sent to a server.

Can my existing web service be a step?

Available — v0.0.1 (experimental)pythonhttp

Python HTTP enrichment

A Python service adds a field to each record over the HTTP Pipe Protocol. Plain curl can drive it; a pipeline references it and must grant the network destination.

Available in v0.0.1: the files, README and tests are in examples/python-http-enrich of the openflange-go repository. Commands run from the repository root.

Needs: python3 (standard library only), curl and jq.

A pipe is a data-processing step with declared inputs and outputs.

What goes in, what comes out

Command
python3 examples/python-http-enrich/server.py & sleep 1; examples/python-http-enrich/curl-demo.sh; kill %1
curl-demo.sh — the whole protocol in four steps
B=http://127.0.0.1:8765
# 1. open a session
ID=$(curl -sS -X POST "$B/pipes/enrich-email/sessions" -H 'Content-Type: application/json' \
       -d '{"version":"0.1.0","inputs":["records"],"outputs":["enriched"],"parameters":{}}' | jq -r .sessionId)
# 2. attach the output reader first, in the background
curl -sSN "$B/sessions/$ID/outputs/enriched" > enriched.ndjson &
# 3. stream the input; 204 arrives when the whole body has been read
printf '%s\n' '{"id":1,"email":"Alice@Example.COM"}' '{"id":2,"email":"not-an-address"}' \
  | curl -sS -X POST -H 'Content-Type: application/x-ndjson' -T - "$B/sessions/$ID/inputs/records"
wait
# 4. the session status is the authoritative outcome
curl -sS "$B/sessions/$ID" | jq -r .state     # completed
Output
input:  HTTP 204
status: completed
{"id":1,"email":"Alice@Example.COM","domain":"example.com"}
{"id":2,"email":"not-an-address","domain":null}

Files and further commands

The node in examples/python-http-enrich/pipeline.yaml
enrich:
  pipe: ./enrich-email
  inputs:
    records: {from: inputs.records}
  grants:
    network: ["127.0.0.1:8765"]
    remoteData: ["127.0.0.1"]
Through the runner (the pipeline also filters out unknown domains)
python3 examples/python-http-enrich/server.py & sleep 1; printf '%s\n' '{"id":1,"email":"Alice@Example.COM"}' '{"id":2,"email":"not-an-address"}' '{"id":3,"email":"bob@example.org"}' | openflange run ./examples/python-http-enrich/pipeline.yaml; kill %1
# {"id":1,"email":"Alice@Example.COM","domain":"example.com"}
# {"id":3,"email":"bob@example.org","domain":"example.org"}

What to notice

  • The first command needs no OpenFlange software: the service implements the HTTP Pipe Protocol, and the language it is written in is invisible to the caller.
  • Without the grants the runner refuses before any connection is made (E_PERMISSION); without the server the run fails with E_RUNTIME instead of hanging.
  • remoteData is declared even on loopback, so the manifest stays true when the URL is changed to a real host.
  • The example server binds 127.0.0.1 and has no authentication. Do not expose it to a network as it is; put TLS and authentication in front.