api-chain-runner 2.5.5__tar.gz → 3.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {api_chain_runner-2.5.5/api_chain_runner.egg-info → api_chain_runner-3.1.1}/PKG-INFO +67 -1
- {api_chain_runner-2.5.5 → api_chain_runner-3.1.1}/PYPI_README.md +66 -0
- {api_chain_runner-2.5.5 → api_chain_runner-3.1.1}/README.md +68 -0
- {api_chain_runner-2.5.5 → api_chain_runner-3.1.1}/api_chain_runner/__init__.py +1 -1
- {api_chain_runner-2.5.5 → api_chain_runner-3.1.1}/api_chain_runner/executor.py +22 -6
- {api_chain_runner-2.5.5 → api_chain_runner-3.1.1}/api_chain_runner/models.py +2 -0
- api_chain_runner-3.1.1/api_chain_runner/net.py +45 -0
- api_chain_runner-3.1.1/api_chain_runner/ui/server.py +1414 -0
- api_chain_runner-3.1.1/api_chain_runner/ui/static/env.js +274 -0
- {api_chain_runner-2.5.5 → api_chain_runner-3.1.1}/api_chain_runner/ui/static/flow.js +1087 -14
- {api_chain_runner-2.5.5 → api_chain_runner-3.1.1}/api_chain_runner/ui/static/style.css +583 -0
- {api_chain_runner-2.5.5 → api_chain_runner-3.1.1}/api_chain_runner/ui/templates/docs.html +3 -0
- {api_chain_runner-2.5.5 → api_chain_runner-3.1.1}/api_chain_runner/ui/templates/editor.html +3 -0
- api_chain_runner-3.1.1/api_chain_runner/ui/templates/env_button.html +7 -0
- api_chain_runner-3.1.1/api_chain_runner/ui/templates/env_modal.html +30 -0
- api_chain_runner-3.1.1/api_chain_runner/ui/templates/flow.html +273 -0
- {api_chain_runner-2.5.5 → api_chain_runner-3.1.1}/api_chain_runner/ui/templates/icons.html +41 -5
- {api_chain_runner-2.5.5 → api_chain_runner-3.1.1}/api_chain_runner/ui/templates/index.html +3 -0
- {api_chain_runner-2.5.5 → api_chain_runner-3.1.1/api_chain_runner.egg-info}/PKG-INFO +67 -1
- {api_chain_runner-2.5.5 → api_chain_runner-3.1.1}/api_chain_runner.egg-info/SOURCES.txt +4 -0
- api_chain_runner-2.5.5/api_chain_runner/ui/server.py +0 -770
- api_chain_runner-2.5.5/api_chain_runner/ui/templates/flow.html +0 -138
- {api_chain_runner-2.5.5 → api_chain_runner-3.1.1}/.gitignore +0 -0
- {api_chain_runner-2.5.5 → api_chain_runner-3.1.1}/MANIFEST.in +0 -0
- {api_chain_runner-2.5.5 → api_chain_runner-3.1.1}/api_chain_runner/__main__.py +0 -0
- {api_chain_runner-2.5.5 → api_chain_runner-3.1.1}/api_chain_runner/generator.py +0 -0
- {api_chain_runner-2.5.5 → api_chain_runner-3.1.1}/api_chain_runner/logger.py +0 -0
- {api_chain_runner-2.5.5 → api_chain_runner-3.1.1}/api_chain_runner/pause.py +0 -0
- {api_chain_runner-2.5.5 → api_chain_runner-3.1.1}/api_chain_runner/resolver.py +0 -0
- {api_chain_runner-2.5.5 → api_chain_runner-3.1.1}/api_chain_runner/runner.py +0 -0
- {api_chain_runner-2.5.5 → api_chain_runner-3.1.1}/api_chain_runner/store.py +0 -0
- {api_chain_runner-2.5.5 → api_chain_runner-3.1.1}/api_chain_runner/ui/__init__.py +0 -0
- {api_chain_runner-2.5.5 → api_chain_runner-3.1.1}/api_chain_runner/ui/static/create.js +0 -0
- {api_chain_runner-2.5.5 → api_chain_runner-3.1.1}/api_chain_runner/ui/static/docs.js +0 -0
- {api_chain_runner-2.5.5 → api_chain_runner-3.1.1}/api_chain_runner/ui/static/sidebar.js +0 -0
- {api_chain_runner-2.5.5 → api_chain_runner-3.1.1}/api_chain_runner/ui/static/theme.js +0 -0
- {api_chain_runner-2.5.5 → api_chain_runner-3.1.1}/api_chain_runner.egg-info/dependency_links.txt +0 -0
- {api_chain_runner-2.5.5 → api_chain_runner-3.1.1}/api_chain_runner.egg-info/entry_points.txt +0 -0
- {api_chain_runner-2.5.5 → api_chain_runner-3.1.1}/api_chain_runner.egg-info/requires.txt +0 -0
- {api_chain_runner-2.5.5 → api_chain_runner-3.1.1}/api_chain_runner.egg-info/top_level.txt +0 -0
- {api_chain_runner-2.5.5 → api_chain_runner-3.1.1}/pyproject.toml +0 -0
- {api_chain_runner-2.5.5 → api_chain_runner-3.1.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: api-chain-runner
|
|
3
|
-
Version:
|
|
3
|
+
Version: 3.1.1
|
|
4
4
|
Summary: Execute chained API calls defined in YAML configuration files
|
|
5
5
|
Author-email: Sambit Saha <creativesambit@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -421,10 +421,76 @@ This opens a local web server at `http://127.0.0.1:5656` with:
|
|
|
421
421
|
- **Run from UI** — execute flows live with real-time pass/fail status and color-coded HTTP status codes
|
|
422
422
|
- **Step Responses** — response table with status, duration, and resizable response body preview
|
|
423
423
|
- **Step Editor** — click any step to edit URL, headers, payload directly and save back to the YAML file
|
|
424
|
+
- **Run Selected Steps** — Ctrl/Cmd+click steps to run only those; a popup asks for the payload and query-param values, with the keys filled in for you
|
|
425
|
+
- **Retry Failed Steps** — when a stop-on-fail step fails, a Retry button re-runs it and continues the chain with the existing context
|
|
426
|
+
- **Add Step on Hover** — hover any step card to insert a new step right after it (API request or manual step)
|
|
427
|
+
- **Step List in the Sidebar** — every step of the open flow is listed with its method; click one to jump to it and open the request panel
|
|
428
|
+
- **Request Panel** — a Postman-style window that sends just one step: edit the method, URL, params, headers and body (JSON, form-data with file uploads, or urlencoded), then see the response with highlighted JSON, status, time, size and headers
|
|
429
|
+
- **Environment Variables Editor** — an **Environment** button at the bottom of the sidebar opens a popup to view, add, edit and delete the variables in your `.env` file
|
|
430
|
+
- **API or Manual Steps** — the Add Step drawer lets you pick an API request or a manual step
|
|
431
|
+
- **Glass Design** — translucent glass panels over a soft blue background, tuned for both light and dark mode
|
|
424
432
|
- **Full YAML Editor** — edit the raw YAML with save support
|
|
425
433
|
- **Create New Flows** — create new chains from the dashboard with name, folder, and initial steps
|
|
426
434
|
- **Dark / Light Mode** — toggle themes with persistent preference
|
|
427
435
|
|
|
436
|
+
#### Retry a failed step
|
|
437
|
+
|
|
438
|
+
When a step with `continue_on_error: false` (shown as `stop-on-fail`) fails, the chain stops and a **Retry** button appears beside that step. This covers HTTP errors and any other failure, such as an unresolved `${...}` reference. Clicking it re-runs only that step and then carries on with the rest of the chain, using the responses already collected, so earlier steps are not repeated. If the retry fails again, the button reappears.
|
|
439
|
+
|
|
440
|
+
- The retry reuses the step definitions loaded when the run started. If you edit the YAML after a failure, click **Run Chain** again to pick up the change.
|
|
441
|
+
- Starting a new run discards the retry option of the previous one. The server keeps the 10 most recent failed runs.
|
|
442
|
+
|
|
443
|
+
#### Add a step anywhere
|
|
444
|
+
|
|
445
|
+
Hover over a step card and an **Add Step** button appears below it. Clicking it opens the new-step drawer and inserts the step directly after that card. At the top of the drawer, **Step type** lets you choose an **API request** or a **Manual step**; the form switches accordingly and keeps the name you typed. A manual step needs an instruction. The first card also shows a button above it, to insert at the start.
|
|
446
|
+
|
|
447
|
+
#### Run only selected steps
|
|
448
|
+
|
|
449
|
+
Ctrl/Cmd+click one or more step cards to select them. A numbered badge shows the run order, and the Run button changes to **Run Selected (N)**. Click **Clear selection** or press `Esc` to deselect. A plain click still opens the step drawer.
|
|
450
|
+
|
|
451
|
+
Clicking **Run Selected** opens a popup listing each selected step's **query params** (read from the `?a=b` part of the URL) and **payload** keys (nested objects and lists included). The keys fill in automatically and each value starts as the one in the YAML. Change only the values you need.
|
|
452
|
+
|
|
453
|
+
- Values apply to this run only. The YAML file is never changed.
|
|
454
|
+
- Typed values keep the original type: a number stays a number, and booleans use a true/false dropdown.
|
|
455
|
+
- A value that references a step you did not select (for example `${login.token}`) is highlighted, because that step will not run. Enter a value to use instead.
|
|
456
|
+
- Unselected steps are shown as skipped ("Not selected") and are not counted as failures.
|
|
457
|
+
- A selected step whose `condition` points at a step that has not run is executed rather than silently skipped. Full runs keep the existing skip behaviour.
|
|
458
|
+
- If the popup has nothing to fill in (no query params or payload), the steps run immediately.
|
|
459
|
+
- Headers and file uploads are not editable in the popup.
|
|
460
|
+
|
|
461
|
+
#### Send a single step (request panel)
|
|
462
|
+
|
|
463
|
+
Click a step in the sidebar's **Steps** list to open a Postman-style request panel for that step. It sends exactly one request, so polling, retries, delays and conditions are ignored. Nothing is written to the YAML; use **Edit step** in the panel header to change the saved step.
|
|
464
|
+
|
|
465
|
+
- **Request bar:** method dropdown, URL, and **Send** (also `Ctrl/Cmd + Enter` from anywhere in the panel).
|
|
466
|
+
- **Params:** the query string as editable rows, kept in sync with the URL in both directions. Untick a row to leave it out without deleting it.
|
|
467
|
+
- **Headers:** editable rows with the same on/off checkbox.
|
|
468
|
+
- **Body:** choose **None**, **JSON** (with a live validity check and **Beautify**), **Form-data** or **x-www-form-urlencoded**.
|
|
469
|
+
- In **Form-data**, each row is **Text** or **File**. A file row takes a path on your machine, or use **Choose file** to pick one in the browser.
|
|
470
|
+
- Content-Type is set automatically for form bodies, so any `Content-Type` header is ignored.
|
|
471
|
+
- Steps that already use `files:` open in Form-data with their files filled in.
|
|
472
|
+
- If two form fields share a name, only the last one is sent.
|
|
473
|
+
- **Response:** a status chip (for example `200 OK`), time and size, a syntax-highlighted body with Wrap and Copy, and a Headers tab (click a row to copy a value). Connection errors appear as an error card.
|
|
474
|
+
- **Copy cURL:** copies the request as a ready-to-run cURL command, including `-F` parts for form-data.
|
|
475
|
+
- **Resizable:** drag the divider between the request and the response.
|
|
476
|
+
- `${ENV:NAME}` placeholders are substituted before sending. `${step.key}` references resolve from the last run of the flow, or from earlier sends in the panel. If one can't be resolved, the panel says so instead of sending, so run the chain first or type a literal value.
|
|
477
|
+
- Unique fields (for example email or PAN) are regenerated on every send.
|
|
478
|
+
|
|
479
|
+
#### Environment variables editor
|
|
480
|
+
|
|
481
|
+
The **Environment** button at the bottom of the sidebar opens a popup for your `.env` file. It is available on every page.
|
|
482
|
+
|
|
483
|
+
- Values are hidden by default. Use the eye on a row (or **Show values**) to reveal them, and the copy button to copy one.
|
|
484
|
+
- Filter by name, add a variable, edit any name or value, or remove one. Names must use letters, digits and `_` and not start with a digit; duplicates and line breaks in values are flagged and block saving.
|
|
485
|
+
- The popup edits the first existing `.env` the runner would load: the flow folder, then its parent, then the current working directory. If more than one exists, a dropdown lets you choose. If none exists, saving creates one in the flow folder with owner-only permissions.
|
|
486
|
+
- Comments, blank lines and values you did not change are kept exactly as written.
|
|
487
|
+
- Saved values apply to this server straight away, so the next run uses them without a restart. A run that is already in progress is not affected.
|
|
488
|
+
- Use any variable in a flow as `${ENV:NAME}`.
|
|
489
|
+
|
|
490
|
+
#### Network: IPv4 first (CLI and UI)
|
|
491
|
+
|
|
492
|
+
Connections try IPv4 first and fall back to the normal lookup only if a host has no IPv4 address. On networks that publish IPv6 addresses but cannot route them, this avoids waiting for the connect timeout on each IPv6 address (which could take 90 seconds or more). Set `API_CHAIN_RUNNER_IPV6_FIRST=1` to turn this off.
|
|
493
|
+
|
|
428
494
|
No extra setup needed — the UI is included in the package.
|
|
429
495
|
|
|
430
496
|
## Step Fields Reference
|
|
@@ -393,10 +393,76 @@ This opens a local web server at `http://127.0.0.1:5656` with:
|
|
|
393
393
|
- **Run from UI** — execute flows live with real-time pass/fail status and color-coded HTTP status codes
|
|
394
394
|
- **Step Responses** — response table with status, duration, and resizable response body preview
|
|
395
395
|
- **Step Editor** — click any step to edit URL, headers, payload directly and save back to the YAML file
|
|
396
|
+
- **Run Selected Steps** — Ctrl/Cmd+click steps to run only those; a popup asks for the payload and query-param values, with the keys filled in for you
|
|
397
|
+
- **Retry Failed Steps** — when a stop-on-fail step fails, a Retry button re-runs it and continues the chain with the existing context
|
|
398
|
+
- **Add Step on Hover** — hover any step card to insert a new step right after it (API request or manual step)
|
|
399
|
+
- **Step List in the Sidebar** — every step of the open flow is listed with its method; click one to jump to it and open the request panel
|
|
400
|
+
- **Request Panel** — a Postman-style window that sends just one step: edit the method, URL, params, headers and body (JSON, form-data with file uploads, or urlencoded), then see the response with highlighted JSON, status, time, size and headers
|
|
401
|
+
- **Environment Variables Editor** — an **Environment** button at the bottom of the sidebar opens a popup to view, add, edit and delete the variables in your `.env` file
|
|
402
|
+
- **API or Manual Steps** — the Add Step drawer lets you pick an API request or a manual step
|
|
403
|
+
- **Glass Design** — translucent glass panels over a soft blue background, tuned for both light and dark mode
|
|
396
404
|
- **Full YAML Editor** — edit the raw YAML with save support
|
|
397
405
|
- **Create New Flows** — create new chains from the dashboard with name, folder, and initial steps
|
|
398
406
|
- **Dark / Light Mode** — toggle themes with persistent preference
|
|
399
407
|
|
|
408
|
+
#### Retry a failed step
|
|
409
|
+
|
|
410
|
+
When a step with `continue_on_error: false` (shown as `stop-on-fail`) fails, the chain stops and a **Retry** button appears beside that step. This covers HTTP errors and any other failure, such as an unresolved `${...}` reference. Clicking it re-runs only that step and then carries on with the rest of the chain, using the responses already collected, so earlier steps are not repeated. If the retry fails again, the button reappears.
|
|
411
|
+
|
|
412
|
+
- The retry reuses the step definitions loaded when the run started. If you edit the YAML after a failure, click **Run Chain** again to pick up the change.
|
|
413
|
+
- Starting a new run discards the retry option of the previous one. The server keeps the 10 most recent failed runs.
|
|
414
|
+
|
|
415
|
+
#### Add a step anywhere
|
|
416
|
+
|
|
417
|
+
Hover over a step card and an **Add Step** button appears below it. Clicking it opens the new-step drawer and inserts the step directly after that card. At the top of the drawer, **Step type** lets you choose an **API request** or a **Manual step**; the form switches accordingly and keeps the name you typed. A manual step needs an instruction. The first card also shows a button above it, to insert at the start.
|
|
418
|
+
|
|
419
|
+
#### Run only selected steps
|
|
420
|
+
|
|
421
|
+
Ctrl/Cmd+click one or more step cards to select them. A numbered badge shows the run order, and the Run button changes to **Run Selected (N)**. Click **Clear selection** or press `Esc` to deselect. A plain click still opens the step drawer.
|
|
422
|
+
|
|
423
|
+
Clicking **Run Selected** opens a popup listing each selected step's **query params** (read from the `?a=b` part of the URL) and **payload** keys (nested objects and lists included). The keys fill in automatically and each value starts as the one in the YAML. Change only the values you need.
|
|
424
|
+
|
|
425
|
+
- Values apply to this run only. The YAML file is never changed.
|
|
426
|
+
- Typed values keep the original type: a number stays a number, and booleans use a true/false dropdown.
|
|
427
|
+
- A value that references a step you did not select (for example `${login.token}`) is highlighted, because that step will not run. Enter a value to use instead.
|
|
428
|
+
- Unselected steps are shown as skipped ("Not selected") and are not counted as failures.
|
|
429
|
+
- A selected step whose `condition` points at a step that has not run is executed rather than silently skipped. Full runs keep the existing skip behaviour.
|
|
430
|
+
- If the popup has nothing to fill in (no query params or payload), the steps run immediately.
|
|
431
|
+
- Headers and file uploads are not editable in the popup.
|
|
432
|
+
|
|
433
|
+
#### Send a single step (request panel)
|
|
434
|
+
|
|
435
|
+
Click a step in the sidebar's **Steps** list to open a Postman-style request panel for that step. It sends exactly one request, so polling, retries, delays and conditions are ignored. Nothing is written to the YAML; use **Edit step** in the panel header to change the saved step.
|
|
436
|
+
|
|
437
|
+
- **Request bar:** method dropdown, URL, and **Send** (also `Ctrl/Cmd + Enter` from anywhere in the panel).
|
|
438
|
+
- **Params:** the query string as editable rows, kept in sync with the URL in both directions. Untick a row to leave it out without deleting it.
|
|
439
|
+
- **Headers:** editable rows with the same on/off checkbox.
|
|
440
|
+
- **Body:** choose **None**, **JSON** (with a live validity check and **Beautify**), **Form-data** or **x-www-form-urlencoded**.
|
|
441
|
+
- In **Form-data**, each row is **Text** or **File**. A file row takes a path on your machine, or use **Choose file** to pick one in the browser.
|
|
442
|
+
- Content-Type is set automatically for form bodies, so any `Content-Type` header is ignored.
|
|
443
|
+
- Steps that already use `files:` open in Form-data with their files filled in.
|
|
444
|
+
- If two form fields share a name, only the last one is sent.
|
|
445
|
+
- **Response:** a status chip (for example `200 OK`), time and size, a syntax-highlighted body with Wrap and Copy, and a Headers tab (click a row to copy a value). Connection errors appear as an error card.
|
|
446
|
+
- **Copy cURL:** copies the request as a ready-to-run cURL command, including `-F` parts for form-data.
|
|
447
|
+
- **Resizable:** drag the divider between the request and the response.
|
|
448
|
+
- `${ENV:NAME}` placeholders are substituted before sending. `${step.key}` references resolve from the last run of the flow, or from earlier sends in the panel. If one can't be resolved, the panel says so instead of sending, so run the chain first or type a literal value.
|
|
449
|
+
- Unique fields (for example email or PAN) are regenerated on every send.
|
|
450
|
+
|
|
451
|
+
#### Environment variables editor
|
|
452
|
+
|
|
453
|
+
The **Environment** button at the bottom of the sidebar opens a popup for your `.env` file. It is available on every page.
|
|
454
|
+
|
|
455
|
+
- Values are hidden by default. Use the eye on a row (or **Show values**) to reveal them, and the copy button to copy one.
|
|
456
|
+
- Filter by name, add a variable, edit any name or value, or remove one. Names must use letters, digits and `_` and not start with a digit; duplicates and line breaks in values are flagged and block saving.
|
|
457
|
+
- The popup edits the first existing `.env` the runner would load: the flow folder, then its parent, then the current working directory. If more than one exists, a dropdown lets you choose. If none exists, saving creates one in the flow folder with owner-only permissions.
|
|
458
|
+
- Comments, blank lines and values you did not change are kept exactly as written.
|
|
459
|
+
- Saved values apply to this server straight away, so the next run uses them without a restart. A run that is already in progress is not affected.
|
|
460
|
+
- Use any variable in a flow as `${ENV:NAME}`.
|
|
461
|
+
|
|
462
|
+
#### Network: IPv4 first (CLI and UI)
|
|
463
|
+
|
|
464
|
+
Connections try IPv4 first and fall back to the normal lookup only if a host has no IPv4 address. On networks that publish IPv6 addresses but cannot route them, this avoids waiting for the connect timeout on each IPv6 address (which could take 90 seconds or more). Set `API_CHAIN_RUNNER_IPV6_FIRST=1` to turn this off.
|
|
465
|
+
|
|
400
466
|
No extra setup needed — the UI is included in the package.
|
|
401
467
|
|
|
402
468
|
## Step Fields Reference
|
|
@@ -591,10 +591,76 @@ This opens a local web server at `http://127.0.0.1:5656` with:
|
|
|
591
591
|
- **Run from UI** — click "Run Chain" to execute the flow live; each step lights up with pass/fail status and HTTP status codes color-coded (green for 2xx, orange for 4xx, red for 5xx)
|
|
592
592
|
- **Step Responses** — after a run, a response table shows every step's status code, duration, and response body with resizable preview
|
|
593
593
|
- **Step Editor** — click any step to open a slide-over drawer showing full details (URL, headers, payload, polling config); editable fields can be modified and saved directly back to the YAML file
|
|
594
|
+
- **Run Selected Steps** — Ctrl/Cmd+click steps to run only those; a popup asks for the payload and query-param values, with the keys filled in for you
|
|
595
|
+
- **Retry Failed Steps** — when a stop-on-fail step fails, a Retry button re-runs it and continues the chain with the existing context
|
|
596
|
+
- **Add Step on Hover** — hover any step card to insert a new step right after it (API request or manual step)
|
|
597
|
+
- **Step List in the Sidebar** — every step of the open flow is listed with its method; click one to jump to it and open the request panel
|
|
598
|
+
- **Request Panel** — a Postman-style window that sends just one step: edit the method, URL, params, headers and body (JSON, form-data with file uploads, or urlencoded), then see the response with highlighted JSON, status, time, size and headers
|
|
599
|
+
- **Environment Variables Editor** — an **Environment** button at the bottom of the sidebar opens a popup to view, add, edit and delete the variables in your `.env` file
|
|
600
|
+
- **API or Manual Steps** — the Add Step drawer lets you pick an API request or a manual step
|
|
601
|
+
- **Glass Design** — translucent glass panels over a soft blue background, tuned for both light and dark mode
|
|
594
602
|
- **Full YAML Editor** — open the raw YAML editor from the sidebar to edit the entire flow file with syntax-aware editing and save
|
|
595
603
|
- **Create New Flows** — click "New Flow" on the dashboard to create a new chain with a name, optional folder, and initial steps
|
|
596
604
|
- **Dark / Light Mode** — toggle between dark and light themes; preference is persisted across sessions
|
|
597
605
|
|
|
606
|
+
#### Retry a failed step
|
|
607
|
+
|
|
608
|
+
When a step with `continue_on_error: false` (shown as `stop-on-fail`) fails, the chain stops and a **Retry** button appears beside that step. This covers HTTP errors and any other failure, such as an unresolved `${...}` reference. Clicking it re-runs only that step and then carries on with the rest of the chain, using the responses already collected, so earlier steps are not repeated. If the retry fails again, the button reappears.
|
|
609
|
+
|
|
610
|
+
- The retry reuses the step definitions loaded when the run started. If you edit the YAML after a failure, click **Run Chain** again to pick up the change.
|
|
611
|
+
- Starting a new run discards the retry option of the previous one. The server keeps the 10 most recent failed runs.
|
|
612
|
+
|
|
613
|
+
#### Add a step anywhere
|
|
614
|
+
|
|
615
|
+
Hover over a step card and an **Add Step** button appears below it. Clicking it opens the new-step drawer and inserts the step directly after that card. At the top of the drawer, **Step type** lets you choose an **API request** or a **Manual step**; the form switches accordingly and keeps the name you typed. A manual step needs an instruction. The first card also shows a button above it, to insert at the start.
|
|
616
|
+
|
|
617
|
+
#### Run only selected steps
|
|
618
|
+
|
|
619
|
+
Ctrl/Cmd+click one or more step cards to select them. A numbered badge shows the run order, and the Run button changes to **Run Selected (N)**. Click **Clear selection** or press `Esc` to deselect. A plain click still opens the step drawer.
|
|
620
|
+
|
|
621
|
+
Clicking **Run Selected** opens a popup listing each selected step's **query params** (read from the `?a=b` part of the URL) and **payload** keys (nested objects and lists included). The keys fill in automatically and each value starts as the one in the YAML. Change only the values you need.
|
|
622
|
+
|
|
623
|
+
- Values apply to this run only. The YAML file is never changed.
|
|
624
|
+
- Typed values keep the original type: a number stays a number, and booleans use a true/false dropdown.
|
|
625
|
+
- A value that references a step you did not select (for example `${login.token}`) is highlighted, because that step will not run. Enter a value to use instead.
|
|
626
|
+
- Unselected steps are shown as skipped ("Not selected") and are not counted as failures.
|
|
627
|
+
- A selected step whose `condition` points at a step that has not run is executed rather than silently skipped. Full runs keep the existing skip behaviour.
|
|
628
|
+
- If the popup has nothing to fill in (no query params or payload), the steps run immediately.
|
|
629
|
+
- Headers and file uploads are not editable in the popup.
|
|
630
|
+
|
|
631
|
+
#### Send a single step (request panel)
|
|
632
|
+
|
|
633
|
+
Click a step in the sidebar's **Steps** list to open a Postman-style request panel for that step. It sends exactly one request, so polling, retries, delays and conditions are ignored. Nothing is written to the YAML; use **Edit step** in the panel header to change the saved step.
|
|
634
|
+
|
|
635
|
+
- **Request bar:** method dropdown, URL, and **Send** (also `Ctrl/Cmd + Enter` from anywhere in the panel).
|
|
636
|
+
- **Params:** the query string as editable rows, kept in sync with the URL in both directions. Untick a row to leave it out without deleting it.
|
|
637
|
+
- **Headers:** editable rows with the same on/off checkbox.
|
|
638
|
+
- **Body:** choose **None**, **JSON** (with a live validity check and **Beautify**), **Form-data** or **x-www-form-urlencoded**.
|
|
639
|
+
- In **Form-data**, each row is **Text** or **File**. A file row takes a path on your machine, or use **Choose file** to pick one in the browser.
|
|
640
|
+
- Content-Type is set automatically for form bodies, so any `Content-Type` header is ignored.
|
|
641
|
+
- Steps that already use `files:` open in Form-data with their files filled in.
|
|
642
|
+
- If two form fields share a name, only the last one is sent.
|
|
643
|
+
- **Response:** a status chip (for example `200 OK`), time and size, a syntax-highlighted body with Wrap and Copy, and a Headers tab (click a row to copy a value). Connection errors appear as an error card.
|
|
644
|
+
- **Copy cURL:** copies the request as a ready-to-run cURL command, including `-F` parts for form-data.
|
|
645
|
+
- **Resizable:** drag the divider between the request and the response.
|
|
646
|
+
- `${ENV:NAME}` placeholders are substituted before sending. `${step.key}` references resolve from the last run of the flow, or from earlier sends in the panel. If one can't be resolved, the panel says so instead of sending, so run the chain first or type a literal value.
|
|
647
|
+
- Unique fields (for example email or PAN) are regenerated on every send.
|
|
648
|
+
|
|
649
|
+
#### Environment variables editor
|
|
650
|
+
|
|
651
|
+
The **Environment** button at the bottom of the sidebar opens a popup for your `.env` file. It is available on every page.
|
|
652
|
+
|
|
653
|
+
- Values are hidden by default. Use the eye on a row (or **Show values**) to reveal them, and the copy button to copy one.
|
|
654
|
+
- Filter by name, add a variable, edit any name or value, or remove one. Names must use letters, digits and `_` and not start with a digit; duplicates and line breaks in values are flagged and block saving.
|
|
655
|
+
- The popup edits the first existing `.env` the runner would load: the flow folder, then its parent, then the current working directory. If more than one exists, a dropdown lets you choose. If none exists, saving creates one in the flow folder with owner-only permissions.
|
|
656
|
+
- Comments, blank lines and values you did not change are kept exactly as written.
|
|
657
|
+
- Saved values apply to this server straight away, so the next run uses them without a restart. A run that is already in progress is not affected.
|
|
658
|
+
- Use any variable in a flow as `${ENV:NAME}`.
|
|
659
|
+
|
|
660
|
+
#### Network: IPv4 first (CLI and UI)
|
|
661
|
+
|
|
662
|
+
Connections try IPv4 first and fall back to the normal lookup only if a host has no IPv4 address. On networks that publish IPv6 addresses but cannot route them, this avoids waiting for the connect timeout on each IPv6 address (which could take 90 seconds or more). Set `API_CHAIN_RUNNER_IPV6_FIRST=1` to turn this off.
|
|
663
|
+
|
|
598
664
|
The UI is a built-in feature of the package — anyone who installs `python -m api_chain_runner` gets it with no extra setup.
|
|
599
665
|
|
|
600
666
|
## Architecture
|
|
@@ -620,6 +686,8 @@ YAML Config → ChainRunner (orchestrator)
|
|
|
620
686
|
| `generator.py` | `UniqueDataGenerator` — creates unique email, PAN, mobile values; supports custom generators via `register_generator()` |
|
|
621
687
|
| `logger.py` | `ResultLogger` — logs all requests/responses to CSV or Excel with IST timestamps |
|
|
622
688
|
| `models.py` | Data classes (`StepDefinition`, `StepResult`, `ChainResult`, etc.) and validation |
|
|
689
|
+
| `net.py` | IPv4-first connection ordering for `requests`, so unroutable IPv6 addresses do not stall requests |
|
|
690
|
+
| `ui/` | Flask web UI: `server.py` (API and run engine), `templates/`, and `static/` (flow, request panel, environment editor, styles) |
|
|
623
691
|
|
|
624
692
|
### Execution Flow
|
|
625
693
|
|
|
@@ -11,12 +11,15 @@ import requests
|
|
|
11
11
|
from api_chain_runner.generator import UniqueDataGenerator
|
|
12
12
|
from api_chain_runner.logger import ResultLogger
|
|
13
13
|
from api_chain_runner.models import LogEntry, StepDefinition, StepResult
|
|
14
|
+
from api_chain_runner.net import prefer_ipv4
|
|
14
15
|
from api_chain_runner.pause import PauseController
|
|
15
16
|
from api_chain_runner.resolver import ReferenceResolver
|
|
16
17
|
from api_chain_runner.store import ResponseStore
|
|
17
18
|
|
|
18
19
|
IST = timezone(timedelta(hours=5, minutes=30))
|
|
19
20
|
|
|
21
|
+
prefer_ipv4() # avoid 30 s-per-address stalls on networks without working IPv6
|
|
22
|
+
|
|
20
23
|
|
|
21
24
|
class StepExecutor:
|
|
22
25
|
"""Executes a single API step: resolve references, generate unique data,
|
|
@@ -332,12 +335,13 @@ class StepExecutor:
|
|
|
332
335
|
}
|
|
333
336
|
|
|
334
337
|
opened_files = []
|
|
335
|
-
|
|
338
|
+
form_mode = step.body_type == "form"
|
|
339
|
+
if step.files or form_mode:
|
|
336
340
|
# Multipart file upload — open files and attach as multipart/form-data
|
|
337
341
|
# files values can be a string (single file) or a list (multiple files
|
|
338
342
|
# under the same field name, e.g. shop images).
|
|
339
343
|
files_list = []
|
|
340
|
-
for field_name, file_path in step.files.items():
|
|
344
|
+
for field_name, file_path in (step.files or {}).items():
|
|
341
345
|
paths = file_path if isinstance(file_path, list) else [file_path]
|
|
342
346
|
for fp in paths:
|
|
343
347
|
p = Path(fp)
|
|
@@ -345,10 +349,21 @@ class StepExecutor:
|
|
|
345
349
|
fh = open(p, "rb")
|
|
346
350
|
opened_files.append(fh)
|
|
347
351
|
files_list.append((field_name, (p.name, fh, mime_type)))
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
+
if form_mode:
|
|
353
|
+
# Text fields travel as multipart parts too, so text-only forms are multipart as well.
|
|
354
|
+
for field_name, value in (resolved_payload or {}).items():
|
|
355
|
+
text = value if isinstance(value, str) else (
|
|
356
|
+
json.dumps(value) if isinstance(value, (dict, list)) else str(value)
|
|
357
|
+
)
|
|
358
|
+
files_list.append((field_name, (None, text)))
|
|
359
|
+
request_kwargs["files"] = files_list
|
|
360
|
+
else:
|
|
361
|
+
request_kwargs["files"] = files_list
|
|
362
|
+
# Send any extra payload fields as form data alongside the file
|
|
363
|
+
if resolved_payload:
|
|
364
|
+
request_kwargs["data"] = resolved_payload
|
|
365
|
+
elif step.body_type == "urlencoded":
|
|
366
|
+
request_kwargs["data"] = resolved_payload
|
|
352
367
|
else:
|
|
353
368
|
request_kwargs["json"] = resolved_payload
|
|
354
369
|
|
|
@@ -376,6 +391,7 @@ class StepExecutor:
|
|
|
376
391
|
duration_ms=duration_ms,
|
|
377
392
|
success=200 <= response.status_code < 300,
|
|
378
393
|
eval_result=eval_values,
|
|
394
|
+
response_headers=dict(response.headers),
|
|
379
395
|
)
|
|
380
396
|
|
|
381
397
|
except requests.RequestException as e:
|
|
@@ -105,6 +105,7 @@ class StepDefinition:
|
|
|
105
105
|
eval_condition: str | None = None # Python expression to evaluate using eval_keys values
|
|
106
106
|
success_message: str | None = None # message to print on success condition
|
|
107
107
|
failure_message: str | None = None # message to print on failure condition
|
|
108
|
+
body_type: str | None = None # runtime only (UI request panel): None/"json" (default), "form" (multipart), "urlencoded"
|
|
108
109
|
|
|
109
110
|
def validate(self) -> None:
|
|
110
111
|
"""Validate this step definition.
|
|
@@ -158,6 +159,7 @@ class StepResult:
|
|
|
158
159
|
success: bool
|
|
159
160
|
error: str | None = None
|
|
160
161
|
eval_result: dict | None = None # extracted eval_keys values (logged to CSV instead of full response)
|
|
162
|
+
response_headers: dict | None = None # HTTP response headers (used by the UI request panel)
|
|
161
163
|
|
|
162
164
|
|
|
163
165
|
@dataclass
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"""Network helpers shared by the CLI and the web UI."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import os
|
|
5
|
+
import socket
|
|
6
|
+
import threading
|
|
7
|
+
|
|
8
|
+
from urllib3.util import connection as _conn
|
|
9
|
+
|
|
10
|
+
_local = threading.local()
|
|
11
|
+
_orig_create_connection = _conn.create_connection
|
|
12
|
+
_orig_allowed_gai_family = _conn.allowed_gai_family
|
|
13
|
+
_installed = False
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _allowed_family():
|
|
17
|
+
forced = getattr(_local, "family", None)
|
|
18
|
+
return forced if forced is not None else _orig_allowed_gai_family()
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _create_connection_ipv4_first(address, *args, **kwargs):
|
|
22
|
+
"""Connect over IPv4 first, falling back to the normal lookup only if the host has no IPv4 address.
|
|
23
|
+
|
|
24
|
+
urllib3 walks the DNS answers in order. On networks that resolve AAAA records but
|
|
25
|
+
cannot route IPv6, every IPv6 address burns the full connect timeout (30 s each)
|
|
26
|
+
before an IPv4 address is tried, so a request can take 90 s or more.
|
|
27
|
+
"""
|
|
28
|
+
_local.family = socket.AF_INET
|
|
29
|
+
try:
|
|
30
|
+
return _orig_create_connection(address, *args, **kwargs)
|
|
31
|
+
except socket.gaierror:
|
|
32
|
+
pass # no A record: let the default resolution try IPv6
|
|
33
|
+
finally:
|
|
34
|
+
_local.family = None
|
|
35
|
+
return _orig_create_connection(address, *args, **kwargs)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def prefer_ipv4() -> None:
|
|
39
|
+
"""Install the IPv4-first connector (idempotent). Set API_CHAIN_RUNNER_IPV6_FIRST=1 to skip it."""
|
|
40
|
+
global _installed
|
|
41
|
+
if _installed or os.environ.get("API_CHAIN_RUNNER_IPV6_FIRST"):
|
|
42
|
+
return
|
|
43
|
+
_conn.allowed_gai_family = _allowed_family
|
|
44
|
+
_conn.create_connection = _create_connection_ipv4_first
|
|
45
|
+
_installed = True
|