Metadata-Version: 2.4
Name: pyhttp-app
Version: 2.3.4
Summary: Local API client and alternative to Postman: collection runner, Postman-compatible scripts, mock servers and an MCP server
Author-email: pyhttp Dev Team <dev@pyhttp.com>
License: # pyhttp Free License 1.1
        
        Copyright (c) 2026 pyhttp Dev Team. All rights reserved.
        
        **In short** (this summary is for orientation; the numbered sections are the
        license): pyhttp is free for everyone, at home and at work, at a company of any
        size, for any purpose including commercial use. No fees, no seats, no
        registration, no time limit. You may copy the official release files inside
        your organization and share them unchanged. The source code is published (on
        PyPI as `pyhttp-app`) so You can inspect and install it; You may modify Your
        own copy, but You may not sell pyhttp, distribute a changed version, or present
        a changed version as pyhttp.
        
        ## 1. Definitions
        
        "Licensor" is the pyhttp Dev Team (dev@pyhttp.com), the copyright owner.
        
        "Software" is pyhttp as distributed by the Licensor: the Windows installer and
        portable `.exe`, the macOS `.dmg` and Homebrew cask, the Linux `.deb`, the
        Python package the Licensor publishes on PyPI as `pyhttp-app` and the
        Homebrew formula that installs it, the `pyhttp run` command-line runner inside
        them, and every update the Licensor publishes under this license. The PyPI
        package contains the Software's source code, which the Licensor publishes so
        You can inspect and install the Software; that source code is part of the
        Software and covered by this license.
        
        "You" is the individual or organization using the Software. For an
        organization, "You" includes its employees and contractors acting on its
        behalf.
        
        ## 2. License grant
        
        Subject to this license, the Licensor grants You a perpetual, worldwide,
        non-exclusive, royalty-free license to install and use any number of copies of
        the Software, on any number of computers, for any purpose, including
        commercial, governmental, educational and nonprofit use.
        
        ## 3. Sharing the Software
        
        You may copy and share **unmodified** official release files free of charge:
        inside your organization (for example through a software catalog or device
        management), with other people, and through package managers and download
        sites, as long as You keep this license and all notices with the files and do
        not present the Software as your own work. You may not charge for the Software,
        bundle it in a product or service that is sold, or offer it to third parties as
        a hosted service.
        
        ## 4. Restrictions
        
        Except where applicable law expressly allows it despite this term, You may not:
        
        - distribute a modified version of the Software, or present a modified version
          as pyhttp (You may modify Your own copy of the published source code for
          Your own use; distributing or publishing those changes is not allowed);
        - decompile, disassemble or reverse engineer the compiled builds of the
          Software (the source code is published on PyPI, so there is no need to);
        - remove or alter copyright, trademark or license notices;
        - rent, lease, sell or sublicense the Software; or
        - use the pyhttp name or logo for anything other than the unmodified Software
          (for example for a modified build or a different product).
        
        Interacting with the Software through its documented HTTP API, command line,
        import/export formats and scripting hooks is allowed and encouraged.
        
        ## 5. Third-party components
        
        The Software bundles open-source components listed in
        THIRD-PARTY-NOTICES.md. Those components remain under their own licenses, which
        take precedence over this license for those components.
        
        ## 6. Updates, add-ons and future editions
        
        Updates the Licensor publishes for the Software are covered by this license.
        The Licensor may offer optional paid add-ons, services or editions under
        separate terms; buying them is never required to keep using the Software under
        this license.
        
        ## 7. Your data
        
        The Software runs on your computer and stores your data there. It does not
        collect telemetry. Its only network traffic is the requests You send with it,
        plus a check of the public releases page for new versions, which You can turn
        off in Settings.
        
        ## 8. Ownership
        
        The Software is licensed, not sold. The Licensor keeps all rights not expressly
        granted here, including all copyright, trademark and other intellectual
        property rights in the Software.
        
        ## 9. Term and termination
        
        This license lasts until terminated. It ends automatically if You breach it;
        You may also end it at any time by deleting all copies. When it ends You must
        stop using the Software and delete your copies. Sections 5, 8, 10, 11 and 12
        survive termination.
        
        ## 10. No warranty
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. The Licensor does
        not promise that the Software is error-free or will be maintained.
        
        ## 11. Limitation of liability
        
        TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE LICENSOR IS NOT LIABLE FOR ANY
        INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL OR PUNITIVE DAMAGES, OR FOR LOSS
        OF DATA, PROFITS OR BUSINESS, ARISING FROM THE SOFTWARE OR THIS LICENSE, EVEN IF
        ADVISED OF THE POSSIBILITY. THE LICENSOR'S TOTAL LIABILITY UNDER THIS LICENSE IS
        LIMITED TO USD 10. Some jurisdictions do not allow these limits; there, they
        apply to the fullest extent permitted.
        
        ## 12. General
        
        This license is governed by the laws of India, and disputes go to the courts
        there, unless the law of your place of residence gives You rights that cannot
        be waived. If any part of this license is unenforceable, the rest remains in
        effect. This license is the entire agreement about the Software and replaces
        every earlier pyhttp license for the releases that ship with it. Questions:
        dev@pyhttp.com.
        
Project-URL: Homepage, https://pyhttp.com
Keywords: http,api,client,postman,rest,testing,mcp
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Software Development :: Testing
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE.md
Requires-Dist: fastapi>=0.110
Requires-Dist: uvicorn>=0.27
Requires-Dist: httpx>=0.27
Requires-Dist: pywebview>=5.0
Requires-Dist: quickjs>=1.19; python_version < "3.13"
Requires-Dist: mini-racer>=0.12; python_version >= "3.13"
Requires-Dist: pyyaml>=6.0
Requires-Dist: mcp>=2
Dynamic: license-file

# pyhttp

A local API client and alternative to Postman — it imports Postman collections
and runs Postman scripts — with a built-in collection runner, in its
own desktop window. Everything stays on your machine: requests live in a SQLite
file, every run writes its responses to plain files, and the backend listens
only on `127.0.0.1`.

> **macOS: "Update with Homebrew" fails on an older pyhttp?** Homebrew 7 must
> trust the pyhttp tap once; pyhttp 2.0.7 and older only report
> `brew upgrade --cask failed (exit code 1)`. Run this in a terminal, then update
> again (from the app, or with the second line):
>
> ```sh
> brew trust pyhttp2/pyhttp
> brew update && brew upgrade --cask pyhttp2/pyhttp/pyhttp
> xattr -dr com.apple.quarantine /Applications/pyhttp.app
> ```
>
> The last line stops the "Apple could not verify pyhttp" popup that follows a
> Terminal upgrade (the build is not notarized; the in-app updater clears the flag
> itself). Your data in `~/Library/Application Support/pyhttp` is kept. Installed from the
> `.dmg` instead? Download the new one and drag pyhttp over the old app.
> Details under [Updates](#updates).

## Features

- Save requests with **name, description, tags**, method, URL, query params,
  headers, body (JSON / text / XML / form), timeout and SSL verification.
- **Autosave**: every edit, new body or pasted JSON is saved half a second after
  you stop typing. The header shows *Saving… / Saved*; Ctrl/Cmd+S saves at once.
- **Bulk edit** for headers, params and variables: one `key: value` per line,
  `//` at the start of a line disables it, and a pasted `?a=1&b=2` query string
  becomes separate params.
- Each request in the sidebar has a **⋯ menu** (or right-click) with Duplicate
  and Delete.
- Compact editor: method, URL and Send sit at the top. Tags and description
  live behind **Details** and show as small chips when collapsed.
- **Named bodies**: a request can hold many bodies, each with its own name
  (for example `valid user`, `missing email`). Search bodies by name or content,
  and tick the ones to send. **Send** hits the request once per checked body and
  saves every output to a run folder, with the body name in the file names. The
  ➤ next to a body sends just that body, without touching the checkboxes
  (Ctrl/Cmd+Shift+Enter does the same for the body in the editor); its ⋯ menu
  duplicates, reorders or deletes a body without opening it.
- **Search** across name, description, URL, tags and body names; filter by tag chips.
- **Flows** (rail → Flows): saved requests wired into a small program, drawn as
  blocks on a canvas in the middle of the window. Blocks: *Send request* (ports ok / fail),
  *Wait for email* (received / timeout), *Set variable*, *If* (true / false), *Wait*, *Log*,
  *HTML / JS view* (submitted / timeout), *JavaScript* (ok / fail), *Stop*. Drag from a port to the block that runs next; a port without a wire ends the flow.
  Values are templates: everything a request can use, plus what the flow made (`{{name}}`
  from *Set variable*, and `{{email.code}}`, `{{email.link}}`, `{{email.subject}}`,
  `{{email.from}}`, `{{email.text}}` from the last email). A run shows each block's result
  as it finishes; what it sends is in the history. Flows are part of Export / Import and of
  cloud sync.
  - *HTML / JS view* shows a list (by default the list in the last response, or
    `{{prev.json.items}}`) and waits for you to pick from it: as a table to tick (at least /
    at most, one or several, only one field such as `id`), or with your own HTML and
    JavaScript in a sandboxed frame (`pyhttp.data`, `pyhttp.submit(value)`,
    `pyhttp.picker(el)`). Preview tries it on sample data. What is picked goes to the next
    block and is kept as `{{selected}}` (`{{selected[0].id}}` works too).
  - *JavaScript* runs on what came before (`input`: the items picked or the value the last
    script returned, else the last response's JSON; `vars`, `prev`, `email`), and hands on
    what it returns. `set('payload', {...})` makes `{{payload}}` for the next request's body,
    `fail('why')` takes the fail port; *Try it* runs it on sample input. Together: list →
    pick 5 of 15 → build the body → send the next request.
  - *Folders*: a flow can sit in a folder ("Auth/Signup" nests). Drag flows onto a folder,
    or use the folder button on a flow; a folder's buttons run it, add a flow, rename it.
  - *Run selected*: tick flows (or a whole folder) and run them one after the other; the
    panel under the list follows them, and a flow that waits for a pick says "needs you".
  - *History*: every finished run of a flow is kept with its log (the newest 50): when it
    ran, what started it, how it ended. The History tab next to the run log lists them; a
    click reads one again, with the blocks marked as they ended.
  - *Which email*: up to four lines (From, Subject, Text, To: each "contains", capitals do
    not matter, an empty line is ignored) and a choice of **ALL of these (and)** or **ANY of
    these (or)**. The block says back in words what it will take, "Try it on my inbox" shows
    which messages there fit and why the others do not, and a run that got no message says
    what did arrive and why it was skipped (or that the mail came before the flow started).
  - *Start*: when you press Run, or **by itself when an email arrives** that fits; the run
    then begins with that message as `{{email.…}}`.
  - *The inbox*: every pyhttp account has a test inbox, `<name>@inbox.pyhttp.com`. On the web
    it is simply there. The desktop app uses the same one once it is signed in (topbar →
    Cloud): the mail arrives in the cloud and the Email block asks for it there, so the app
    must be online. Not signed in, the block, the sidebar and the run log say so, with a
    Sign in button. Starting a flow by itself on an arriving email is for the web, where
    something is always running; on the desktop such a flow is run by hand.
  - Use cases: sign up, wait for the verification mail, send its code on; password reset;
    an order confirmation mail starts a check of the order; create, then poll until ready; a
    smoke test that branches on a status.
- **Monitors** (rail → Monitors, a section with its own page: every monitor at a glance with
  Pause all / Resume all / Run all now; one monitor with its uptime, average time, the
  requests it sends and its check history, "Failures only"; the list filters by All /
  Failing / Paused): picked requests are sent again every N
  minutes while the app is open. A check fails when a request errors, answers
  4xx/5xx or fails a test; failing monitors show in the status bar and can POST
  to a webhook. "Run now" sends a check at once.
- **Mock servers** (rail → Mocks): fake endpoints answered by pyhttp itself,
  **on the port it already runs on** — `http://127.0.0.1:8765/mock/<name>/…`, with
  no second process to start. Give a route a method, a path (`/users/:id`), a
  status and a body, and point your front end, a test or another request at it.
  See *Mock servers* below.
- **Streamed responses**: tick *Stream the response live* in a request's
  Settings tab for Server-Sent Events, chunked and AI-style streaming endpoints —
  the body shows as it arrives, and Cancel stops the stream but keeps what came.
- **Keyboard first**: ↑/↓ move through the sidebar, Enter opens, Space ticks for
  a run, Delete removes. Deleting a request or body is **undoable** for a few
  seconds from the toast.
- **Folders**: organise requests in nested folders (for example `QA`, `Prod`,
  `QA / Users`). Drag requests or folders onto a folder, or use the ⋯ menu:
  Add request, Add folder, Run folder, Rename, Move, Delete. Ticking a folder
  selects every request inside it for a run.
- **Environments**: create Dev, QA, Staging, Prod (one click each) or your own.
  Each has its own variables, which override the global ones while it is active.
  Switch from the selector in the top bar; Prod is highlighted in red. Runs
  record which environment they used. Mark a variable **secret** (🔒) and its
  value is masked on screen and replaced by `••••••` in the saved history and run
  files (Postman's `secret` type is kept on import and export).
- In-app dialogs for every confirmation (no browser pop-ups); Escape cancels,
  Enter confirms.
- **Select many** requests, reorder them, and **run them one by one**.
  Progress shows live; each response is stored in the run's output folder.
- **Variables**: `{{base_url}}` anywhere in URL, params, headers or body.
  Global variables apply everywhere; the active environment overrides them.
- **Chaining**: inside a run, `{{prev.json.token}}`, `{{prev.status}}`,
  `{{prev.body}}` and `{{prev.headers.content-type}}` read the previous response.
- Run history, cancel, stop-on-failure, delay between requests.
- Import / export the whole collection as JSON, including folders and
  environments. Import asks whether to add to or replace your collection.
- **Body editor** (CodeMirror): line numbers, code folding, bracket matching,
  syntax colours, `Ctrl+/` comments a line out (removed before the request is
  sent, like Postman), Tab indents, `Ctrl+B` beautifies and keeps your comments,
  and a live status line says "Valid JSON" or points at the broken line.
- **Response viewer**: a collapsible, colour-coded JSON tree (click a key to copy
  its path), Raw and Preview (HTML, images, PDF) views, wrap toggle, a path filter
  (`data.items[*].id`) and `Ctrl+F` search with match count. Save the body to a file.
- **Auth tab**: Basic, Bearer, API key (header or query), Digest, **OAuth 2.0**
  (client credentials or password grant: the token is fetched on the first send,
  cached until it expires, refreshed with the refresh token, and fetched again
  after a `401`; *Get new token* shows its status), or inherit from the folder. Folders have their own settings (auth, headers, variables) that
  every request inside inherits.
- **Body types**: JSON, text, XML, HTML, JavaScript, form (key/value rows),
  form-data with file fields, binary file, GraphQL (query + variables).
- **Scripts tab** (Pre-request and Post-response, like Postman): **tests without
  code** (status, header, body, JSON path and response-time assertions; results in
  the response's Tests tab and in run reports), each for all bodies or for one named
  body; **extract** values from a response into environment or global variables
  (`{{token}}` in the next request); **pre-request variables**; and **scripts** in
  JavaScript with Postman's `pm` API (`pm.test`, `pm.expect`, `pm.response`,
  `pm.environment.set`…) so Postman scripts run unchanged, or in Python with a `py`
  object. `{{body_name}}` (also `body_name` in scripts) tells which body is being sent.
  With several bodies, each script editor has a **for** picker: write a script for
  *All bodies* or for one named body; a body's own pre-request / test script runs
  after the all-bodies one, only when that body is sent.
- **Dependent requests**: in a request's Settings tab, pick another request to
  send first (typically one that fetches a token and saves it with an
  extraction or `pm.environment.set`), and how long its result stays valid.
  The token request runs before the first send, is reused until it expires,
  is fetched once even for parallel sends, and is refreshed automatically with
  one retry when the dependent request comes back 401 or 403.
- **Dynamic variables**: `{{$guid}}`, `{{$timestamp}}`, `{{$isoTimestamp}}`,
  `{{$randomInt 1 100}}`, `{{$randomEmail}}`, `{{$date}}` and more. Path
  variables (`/users/:id`) get their value from a Params row. Unresolved
  variables are flagged before sending.
- **Code snippets** (`</>`): cURL, Python (requests, httpx), JavaScript fetch,
  Node axios, PowerShell, raw HTTP, Go, with variables and auth resolved.
- **Import** Postman Collection v2.1 files and Postman environments, **OpenAPI 3 /
  Swagger 2** specs (JSON or YAML: one folder per tag, `{{baseUrl}}` from the
  servers, bodies from examples and schemas, auth from the security schemes),
  browser **HAR** files, or paste a `curl` command. **Export** as a Postman
  collection (whole collection or one folder).
- **Tabs** for open requests (Ctrl+W closes) and drag to **reorder** requests
  and folders.
- **History** in the right-hand panel: **Run history** lists collection runs,
  **Request history** every single request sent. Filter it by text or by status
  (2xx, 3xx, 4xx, 5xx, errors), send an entry again with one click (↻), reopen
  its response, open a copy as a new request, or **compare** two entries (status,
  time, size, and a line diff of body, headers and request; JSON keys are sorted
  so only real changes show).
- **Split panes**: the request editor and the response are two panes that scroll
  on their own, so the URL, the tabs and the response status always stay in view.
  Drag the edge between them (and the edges of the sidebar and the right-hand panel)
  to resize; double-click an edge to reset. The response goes **below** the request
  or to its **right**: switch in the status bar ("Response: below | right"), with the
  button in the response header, or in Settings. The sidebar hides behind the
  **☰** button (Ctrl/Cmd+\). Errors wrap instead of scrolling sideways.
- **Cookie jar** like a browser: cookies are stored per domain, sent on later
  requests, listed in a Cookies response tab and editable in a manager.
- **Runner options**: iterations, a CSV/JSON **variables file** (one row of
  variable values per iteration, columns as `{{variables}}`; the run dialog
  offers a sample file with a column for each variable your requests use, to
  download or to run with), failing
  tests fail the run, "failed only" filter, HTML/JSON run report. While a run
  goes, every request it sends shows its responses beside the request: one tab
  per body and iteration, so you can compare them without opening the report.
- **Settings**: follow redirects, max redirects, proxy with bypass list, client
  certificates per host, default timeout, User-Agent (default `pyhttp/<version>`), editor font size, response
  below or beside the request, and in-app updates (the Windows builds and Homebrew installs update themselves, see *Updates* below).
- **Response views**: attach your own HTML pages to a request and see its response as a
  chart, a table, a dashboard — in the **View** tab, side by side, or in the browser. See
  *Response views* below.
- **Git sync** (topbar → Git): the project's requests, environments, mocks and monitors as
  JSON files in a Git repository, committed and pushed automatically on every change, and
  pulled back in when a teammate pushes — share a collection without a cloud account. See
  *Git sync* below.
- **Cloud sync** (topbar → Cloud, optional): sign in with GitHub or Google in your browser and
  every project syncs with your pyhttp account, by itself. Edits go up a second after the last
  one, and what you change on another computer or in the web app at `app.pyhttp.com` comes down.
  The list of projects syncs too: create, rename or delete a project on one side and the other
  follows, under the same name (a project deleted elsewhere leaves a copy in `deleted-projects`
  in the data folder). When a project here meets a different one of the same name in the account,
  this computer's is renamed *Name (computer)*. *Keep only here* takes one project out of the
  account and leaves it on this computer. A request changed on both sides is never
  overwritten: you choose *Keep mine* or *Take the cloud's*. Requests, folders, environments,
  variables, mocks, cookies and history sync; settings, monitors and run results stay on the
  computer. Values of 🔒 variables sync too, so your other computers and the web app can use
  them; switch *Sync secret values too* off, before signing in or any time after, and they go up
  empty and stay on the computer. (A computer signed in before this became the default keeps
  them local until you switch it on.)
  Nothing is sent anywhere until you sign in.
- **Share with a link**: with cloud sync on, right-click a request or a folder (or open the
  project menu) → *Share link…*. Whoever has the link sees the current version in the browser and
  can take a copy; values of 🔒 variables are left out. *Stop sharing* ends the link.
- **WebSocket client**: give a request a `ws://` or `wss://` address (written out, or through a
  variable such as `{{events_url}}/orders`) and Send becomes **Connect**. The response area turns into a console: a live log of messages in both
  directions (click a JSON message to pretty-print it), a filter, Ping, and a box to send
  from (Ctrl/Cmd+Enter). The request's query parameters, headers, auth and `{{variables}}`
  are used for the connection, and a `Sec-WebSocket-Protocol` header names the subprotocols
  to offer. Compression (permessage-deflate) and proxies are not supported.
- **Example responses**: the pin button in the response bar saves the response on screen
  with its request (**Examples** tab). Examples go into the documentation export, travel
  with exports and Git sync, and each one can become the answer of a mock route.
- **Compare two responses**: after sending two or more bodies (or iterations), **⇄ Compare**
  in the response strip shows the body, headers and request of any two as a diff.
- **Large responses**: the viewer shows the first 512 KB and offers *Load the whole body*;
  a big JSON document is then drawn as a window of rows, so 100 000 items scroll, expand,
  filter by path and search as smoothly as ten.
- **Secrets in the system keychain** (Settings → General, off by default): the values of 🔒
  variables are kept in Windows Credential Manager, the macOS Keychain or the Secret Service
  (`secret-tool`) instead of the project database. They stay on that computer.
- Native desktop window using the OS webview (WebView2 / WKWebView / WebKitGTK),
  with native save/open dialogs for export and import.
- No Node, no Electron, no build step to run it. Python 3.10+ only (the editor is a
  prebuilt CodeMirror bundle checked into the repo).

## Projects

A project is a separate workspace: its own requests, folders, environments, variables,
history, cookies, run outputs, mocks and monitors. Click the project name in the top bar to
switch, create, rename or delete one. Everything you had before projects existed is the
*Default* project and stays where it was; each new project lives in its own folder under
the data directory (`projects/<id>/pyhttp.db` and `projects/<id>/outputs`). App settings
(theme, proxy, fonts…) are copied into a new project so it does not start bare. The CLI
runner uses the active project, or `pyhttp run --project "Shop API" …` for another one;
`pyhttp mcp --project …` serves one project to an MCP client.

From a terminal: `pyhttp projects` lists them, `pyhttp projects create NAME [--use]`,
`use NAME`, `rename OLD NEW` and `delete NAME` manage them. `pyhttp doctor` checks every
project's database (integrity, row counts), reports run output sizes and orphan folders,
`pyhttp doctor --clean-outputs 30` deletes run folders older than 30 days, and
`pyhttp doctor --vacuum` compacts the databases (worth it after deleting a lot of history;
close pyhttp first).

**Export ▾ → pyhttp JSON** writes the whole project (collection, environments, variables,
mocks, monitors) to one file that imports into another project or machine; monitors and
"send this request first" links are kept. **Export ▾ → Documentation** writes the
collection as Markdown, or as one self-contained HTML page in the app's theme: folders,
requests, parameters, headers (credential-looking values masked), auth, example bodies,
pinned example responses and tests. A folder's ⋯ menu exports just that folder.

## Git sync

Click **Git** in the top bar, choose a folder and press *Turn on Git sync*. From then on the
project's definitions live in a Git repository as well: every request, folder, environment,
mock and monitor is one JSON file, and a change is **committed and pushed by itself** a few
seconds after you stop editing, with the names of what changed as the commit message. It
works the other way too: what a teammate pushes is **pulled, merged and read into the
project**, so a team can share one collection through an ordinary Git repository.

```
pyhttp.json                      marks the folder as written by pyhttp
variables.json                   global variables
monitors.json
collection/Users/_folder.json    a folder's own settings
collection/Users/Login.json      one request
environments/Prod.json
mocks/shop.json
```

- **The folder** can be a repository, a folder inside one (keep the requests next to the code
  they test), or neither — then a repository is created in it. Only the paths above are
  staged, committed or deleted; other files and uncommitted work in the same repository are
  left alone.
- **The remote** is optional. Give a URL and it becomes `origin`; leave it empty and the
  remote the repository already has is used. Without any remote, commits stay local. Pushing
  uses your own Git credentials (credential manager or SSH key). A push that fails is tried
  again with the next change, and the dot on the Git button turns red with the reason in its
  tooltip.
- **Settings → Git** has the switches: *Commit automatically*, *Push automatically* and *Pull
  automatically* (all on by default; with them off, *Sync now* does it), and *Include secret values*
  (off by default: values of variables marked 🔒 are written empty). Tokens and passwords
  typed straight into a request are part of that request and are always written — use a 🔒
  variable for anything that must not reach the repository.
- History, run outputs and cookies are never written. Each project has its own Git folder.
  Sending a request does not commit by itself; variables a script sets go out with the next edit.
- **It works both ways.** With every sync (and when the app starts) the remote is fetched and
  merged, and what changed there is read into the project: a teammate's edited request
  replaces yours under the same id, new ones appear, deleted ones go, and the window reloads
  to show it. Commits you make by hand in the folder are read back the same way. Edits to
  the files that are *not committed* are overwritten by the next sync.
- **When a pull happens:** with your next edit, when the app starts, when you press *Sync
  now*, and on a timer: the remote is looked at every 5 minutes (Settings → Git, 1 minute to
  an hour, or never), so a teammate's push shows up while you are only reading. A remote
  that cannot be reached is skipped quietly by the timer; the next real sync reports it.
- **What a pull keeps:** request and folder ids (history and "send this request first" links
  still point at the right request), and the local value of every 🔒 variable whose value
  was left out of the file. A mock server whose route list changed gets the new list as a
  whole, so the hit counts of its routes start again.
- **Joining a repository:** give a new, empty project the remote URL and an empty folder; it
  starts from what the remote has. If the project already has content and the folder holds a
  different pyhttp project, nothing is replaced until you choose *Load the folder into this
  project* or *Overwrite the folder with this project*.
- **Conflicts:** when you and the remote changed the same request, the merge is undone and
  the Git tab asks: *Take the remote version* or *Keep my version*. Changes to different
  requests merge by themselves. If a pull arrives while you are typing in a request, the
  window does not reload under you (a toast offers *Reload*), and what you save afterwards
  wins for that request.
- In a repository shared with code, *Pull automatically* merges the remote branch into the
  branch that is checked out, code included. Turn it off there if you would rather pull yourself.

## Response views

JSON is not always the best way to look at an answer. A request can carry **views**: HTML
pages of your own that draw its response as a chart, a table, a dashboard, a receipt.

1. Open the **Views** tab of the request (next to Scripts) — before or after sending — or
   the **View** tab of a response.
2. Press **Create a starter view** — pyhttp writes a working page (a bar chart and a table for
   lists, cards for single objects, the raw data) into `<data folder>/views/` and shows it at
   once. Or press **Choose HTML files…** and give the path of a page you already have, or the
   address of one (`http://localhost:5173/chart.html`).
3. Edit the file, press **↻ Reload**.

A request can have **several views**. The chips above the page switch between them, **All**
shows every one side by side, and **↗ Open in browser** opens the one shown (or all of them)
in your browser. *Show the view first* (in **Edit views…**) opens the View tab instead of the
body whenever a response arrives. **History** works the same way: click a call in *Request
history* and it opens in the request's views with the response it holds (the dialog has
Body, Views, Headers, Tests and Request tabs); its ⋯ menu has *Show in its views* and *Open
its views in the browser*. A call of a request without views offers *Add views to this request*.

**How a page gets the response.** pyhttp opens the page as

```
your-page.html?api=http://127.0.0.1:8765/response/<request-name>/<id>&meta=<the same>/meta&theme=dark
```

and the page reads the address from its own URL and fetches it:

```html
<script type="module">
  const query = new URLSearchParams(location.search);
  const data = await fetch(query.get('api')).then((r) => r.json());   // the body, as the API sent it
  const info = await fetch(query.get('meta')).then((r) => r.json());  // name, method, url, status, duration_ms, headers, body, json
  document.body.textContent = `${info.name}: ${data.rows.length} rows`;
</script>
```

- `api` answers with the response body and its original content type; `meta` is JSON about
  the response (and carries the body as `body` and, parsed, as `json`).
- Files next to the HTML file (scripts, styles, images) load with relative paths. Nothing
  above the file's folder is served.
- Inside pyhttp a view runs in a sandboxed frame: it can read the response it was given and
  nothing else of the app. Both addresses allow cross-origin reads, so a page on your own dev
  server or opened from disk can fetch them too. The ids are random and short-lived: pyhttp
  keeps the last 80 responses handed to views in memory, and an old link answers 404 after
  that or after a restart — open the view again.
- A view gets the whole body, also when the response is larger than what the viewer
  (512 KB) and the history (64 KB) keep: bodies above 64 KB are saved in full next to the
  run outputs (`outputs/_bodies/`, up to 64 MB each) and removed with their history entry.
  Calls made before this was added only have the cut copy.
- **Views on a folder**: a folder's ⋯ menu → Settings takes views too. Every request inside
  (also in subfolders) shows them in its View tab, after its own.
- Views are saved with the request (so they travel with exports and Git sync) as the path
  you typed; on another computer the file must exist at the same path, or use a page address.

## Mock servers

An API you need does not exist yet, or you want it to fail on demand. Open
**Mocks** in the top bar, add a mock server, and give it routes. They are
answered by pyhttp itself on the port it already listens on, so there is no
second server to start and no second port to remember:

```
http://127.0.0.1:8765  +  /mock  +  /payments-api  +  /users/42
└ wherever pyhttp runs ┘            └ the mock ┘      └ the route ┘
```

- **Routes** are a method, a path, a status, headers and a body. A path may hold
  parameters written either way (`/users/:id` or `/users/{id}`); `*` matches one
  segment and `**` the rest of the path. `ANY` answers every method. Exact paths
  win over parameter ones, so `/users/me` and `/users/:id` can live side by side.
- **The body is a template**, so a route can answer differently every time and can
  read the call it is answering:
  `{{req.params.id}}` (a path parameter), `{{req.query.limit}}`,
  `{{req.headers.x-key}}`, `{{req.body}}`, `{{req.json.user.name}}`,
  `{{req.method}}`, `{{req.path}}` — plus your own `{{variables}}` and the
  dynamic ones (`{{$guid}}`, `{{$randomEmail}}`…).
- **One path, several answers**: give a route a query condition (`fail=1`) and it
  only answers calls that carry it, so the happy path and the 500 can share
  `/payments/:id`. A route with a condition wins over one without.
- **Delays** per server and per route, to see how your app behaves on a slow API.
- **CORS** headers and preflight (`OPTIONS`) answers are sent by default, so a
  browser app on another origin can call the mock.
- **Calls**: every request a mock answered, newest first, with the headers and
  body it arrived with and which route matched — the quickest way to see what
  your app is really sending. Unmatched calls are flagged, and a 404 from a mock
  lists the routes it does know.
- **From requests…** builds one route per request you already have, answering
  with the response that request last gave.
- **Try** opens a route as a normal request, with the URL written as
  `{{mock_url}}/<name>/…`. `{{mock_url}}` is this app's own `/mock` base, so such
  requests keep working whichever port the app got.
- `GET /mock` lists what is being mocked on this port, for a quick look from
  `curl` or a browser.

Mocks live in the same SQLite file as everything else, and are not part of the
collection export.

## Run it

Requires Python 3.10 or newer.

**Any OS, with pip** (the PyPI name is `pyhttp-app`; the command stays `pyhttp`):

```sh
pip install pyhttp-app     # or: pipx install pyhttp-app
pyhttp
```

On Linux, install the GTK webview bindings first (see *Linux* below) or use
`pyhttp --browser`. `brew install pyhttp2/pyhttp/pyhttp` installs the
same package through Homebrew (macOS and Linux, Intel and ARM; the tap is
[pyhttp2/homebrew-pyhttp](https://github.com/pyhttp2/homebrew-pyhttp)) — or tap
once with `brew tap pyhttp2/pyhttp`, after which plain `brew install pyhttp`,
`brew upgrade pyhttp` and `brew install --cask pyhttp` all work.

**Windows**: double-click `run.bat`. The window opens without a console.
WebView2 ships with Windows 10/11.

**macOS**:

```sh
chmod +x run.sh
./run.sh
```

**Linux**: Ubuntu/Debian users can install the `.deb` instead (see *Desktop apps*).
From source, install the GTK webview bindings once, then use `run.sh`.

```sh
sudo apt install python3-gi gir1.2-webkit2-4.1        # Debian / Ubuntu
sudo dnf install python3-gobject webkit2gtk4.1        # Fedora
chmod +x run.sh
./run.sh
```

The scripts create a `.venv` on first start and reinstall dependencies
whenever `requirements.txt` changes.

### Modes

```sh
python -m pyhttp                 # native window (default)
python -m pyhttp --browser       # open in your web browser at http://127.0.0.1:8765/
python -m pyhttp --server        # API only, for scripting
python -m pyhttp --debug         # native window with devtools
python -m pyhttp --data-dir PATH # keep data somewhere else
python -m pyhttp mcp             # MCP server on stdio, so AI tools can drive pyhttp
```

If no native webview is available, pyhttp prints why and falls back to the
browser automatically.

### Headless runs for CI

`pyhttp run` runs requests without the UI, prints each result, writes reports and
exits with `0` when everything passed, `1` when something failed and `2` for usage
errors, like Postman's newman.

```sh
python -m pyhttp run                                  # every request in your collection
python -m pyhttp run "API/Users" Login --env QA       # folders (name or path) and requests (name or id)
python -m pyhttp run collection.json --env-file qa.postman_environment.json
python -m pyhttp run openapi.yaml --var baseUrl=http://localhost:8000 --list
python -m pyhttp run --tag smoke -n 3 --data users.csv --bail \
    --junit out/junit.xml --html out/report.html --json out/results.json
```

A collection file (Postman v2.1, pyhttp export, OpenAPI, HAR) is run from a
throwaway data folder, so your own collection is not touched. Other options:
`--delay MS`, `--insecure`, `--timeout S`, `--no-fail-on-http-error`,
`--no-fail-on-tests`, `-q`, `--no-color`. Runs started from the command line also
appear in the app's Run history. See `python -m pyhttp run --help`.

### MCP server (AI tools drive pyhttp)

`python -m pyhttp mcp` serves the collection over the
[Model Context Protocol](https://modelcontextprotocol.io) on stdio: an AI tool
can list, create and edit requests, send them, run folders or tags like the
collection runner, read history, switch environments and set variables. Every
tool goes through the same code path as the UI, and the data folder is shared
with the app, so both can be open at the same time.

```sh
claude mcp add pyhttp -- python -m pyhttp mcp          # Claude Code
```

```json
{ "mcpServers": { "pyhttp": { "command": "python", "args": ["-m", "pyhttp", "mcp"] } } }
```

## Where data goes

```
data/
  pyhttp.db                      # requests, folders, environments, variables, run history (SQLite)
  outputs/
    2026-10-07_18-30-00_smoke/   # one folder per run
      summary.json               # run status + one line per request
      01_login.json              # full detail: resolved request, headers, body, timing
      01_login.body.json         # raw response body (extension follows content-type)
      02_create-user__valid-user.json        # one pair per named body
      02_create-user__valid-user.body.json
      02_list-users.json
      02_list-users.body.json
    _bodies/                     # whole bodies of large responses, one file per history entry
```

Use `--data-dir` to put this somewhere else.

Sending with a single checked body shows the response immediately and does not
write files. Sending with two or more checked bodies, or using **Run selected**,
always saves outputs.

## Desktop apps (installer, .exe, .dmg and .deb)

Packaged builds bundle Python and every dependency, so users just double-click.

| OS | File | Data folder |
|---|---|---|
| Windows 10/11 | `pyhttp-<version>-windows-x64-setup.exe`: installer (per user, no admin rights, into `%LOCALAPPDATA%\Programs\pyhttp`, Start menu entry, optional desktop icon, uninstaller in *Apps*) | `%APPDATA%\pyhttp` |
| Windows 10/11 | `pyhttp-<version>-windows-x64.exe`: portable, one file, no install | `%APPDATA%\pyhttp` |
| macOS 11+ | `brew install --cask pyhttp2/pyhttp/pyhttp`, or `pyhttp-<version>-macos-arm64.dmg` (drag pyhttp to Applications). Update from an older pyhttp fails? `brew trust pyhttp2/pyhttp` once, see [Updates](#updates) | `~/Library/Application Support/pyhttp` |
| Ubuntu 22.04+, Debian 12+ | `sudo apt install ./pyhttp-<version>-linux-amd64.deb`: installs to `/usr/lib/pyhttp`, adds `pyhttp` to the PATH and an app-menu entry; uses the distro's GTK and WebKitGTK (pulled in as dependencies) | `~/.local/share/pyhttp` |

Running from source keeps using `./data`. In the packaged app, output that would
go to a console is written to `pyhttp.log` in the data folder. Every release also
ships `SHA256SUMS.txt` with the checksums of the files above.

### Updates

pyhttp looks up the latest release at start (Settings → About: once an hour, or
*Check now*) and shows an **⬆ Update** button in the top bar when a newer version
exists. What the button does depends on how pyhttp was installed:

| Installed as | Update button |
|---|---|
| Windows installer | **Install and restart**: downloads the new installer, verifies it against `SHA256SUMS.txt`, runs it quietly (`/VERYSILENT`) after pyhttp has closed, and the installer starts pyhttp again. |
| Windows portable `.exe` | **Install and restart**: downloads and verifies the new `.exe`, then a small helper (`updates/apply-update.cmd` in the data folder) waits for pyhttp to exit, swaps the file in place (same name, same folder) and starts it again. |
| macOS, installed with Homebrew | **Update with Homebrew**: points a tap made before the move at the current repository, runs `brew trust pyhttp2/pyhttp` (Homebrew 7 loads nothing from a third-party tap until it was trusted once), `brew update` and `brew upgrade --cask pyhttp2/pyhttp/pyhttp` with the output shown in the dialog, removes the quarantine flag and restarts pyhttp. When brew fails, the dialog shows brew's own error line and the command that fixes it. |
| macOS `.dmg` | Download of the new `.dmg`, plus the Homebrew commands to switch (after that, updates install themselves). |
| Linux `.deb` | Download of the new `.deb` plus the `sudo apt install ./pyhttp-<version>-linux-amd64.deb` command to run. |
| From source | Download links and `git pull`. |

**"Update with Homebrew" failed (exit code 1) on pyhttp 2.0.7 or older.** Homebrew 7
loads nothing from a third-party tap until it was trusted once. Macs that
installed pyhttp before the move to `github.com/pyhttp2/pyhttp` trusted the tap
under its old address; once pyhttp points the tap at its new home that trust no
longer applies, and `brew upgrade` stops with *Refusing to load cask
pyhttp2/pyhttp/pyhttp from untrusted tap*. Trust the tap once, then update again
(from the app, or with the second line):

```sh
brew trust pyhttp2/pyhttp
brew update && brew upgrade --cask pyhttp2/pyhttp/pyhttp
xattr -dr com.apple.quarantine /Applications/pyhttp.app
```

The third line clears the quarantine flag that a Terminal upgrade leaves on the
new app; without it the next launch shows "Apple could not verify pyhttp is free
of malware" (see *First launch* below). From 2.0.8 on pyhttp runs the trust step itself and shows Homebrew's own error
line with the fix when something else goes wrong.

Requests, settings and history are kept: they live in the data folder, which no
update touches. The backend is `pyhttp/updater.py` (`POST /api/update/install`,
`GET /api/update/status`); the UI polls the status and shows a progress bar.

### Build on your machine

PyInstaller does not cross-compile: build the `.exe` on Windows and the `.dmg` on a Mac.

```sh
pip install -r requirements.txt -r requirements-build.txt
python packaging/build.py          # result goes to dist/
```

On Windows you can use the project venv: `.venv\Scripts\python packaging\build.py`.
The Windows build produces the portable `.exe` and, when [Inno Setup](https://jrsoftware.org/isdl.php)
6.3+ or 7 is installed, the installer from `packaging/pyhttp.iss` (ISCC.exe is found on
PATH, in Program Files or through the `ISCC` environment variable; without it the
installer is skipped with a note).
A `.dmg` built on an Apple Silicon Mac runs on Apple Silicon; build on an Intel Mac for Intel.

On Ubuntu/Debian the same command builds the `.deb`. Install the GTK bindings and
packaging tools first (`sudo apt install libgirepository1.0-dev libcairo2-dev pkg-config
gir1.2-gtk-3.0 gir1.2-webkit2-4.1 dpkg-dev`, then `pip install "PyGObject<3.51" pycairo`
in the venv). The package leaves GTK, WebKitGTK and the other system libraries to the
distro and declares them as dependencies (`packaging/build.py` works them out from the
bundle, like `dpkg-shlibdeps`). Build on the oldest release you want to support: a
`.deb` built on Ubuntu 22.04 runs on 22.04, 24.04 and Debian 12+.

### Build both on GitHub (no Mac needed)

`.github/workflows/build.yml` builds the Windows `.exe` and the macOS `.dmg` on
GitHub's machines. Every push to `main` only runs the tests (Windows, macOS, Linux).
For a test build without releasing, run the workflow by hand from the Actions tab
(files appear under the run's *Artifacts* for a day). To release:

```sh
python packaging/bump.py 0.1.2
```

That sets `__version__`, commits, creates the tag `v0.1.2` and pushes both. The
tag run publishes the installer, the portable `.exe`, the `.dmg`, `SHA256SUMS.txt`
and the license files to this repository's Releases page, uploads `pyhttp-app` to
PyPI (secret `PYPI_API_TOKEN`) and updates the Homebrew tap
([homebrew-pyhttp](https://github.com/pyhttp2/homebrew-pyhttp): cask + formula;
the tap needs the `RELEASE_TOKEN` secret, a fine-grained PAT with Contents: write
on that repository). The Windows runner installs Inno Setup with Chocolatey when
it is not already there. The in-app updater refuses a release without `SHA256SUMS.txt`,
so keep that step in the workflow. A tag whose version differs from `__version__` is refused,
because the release name, file names and the in-app update check all come from
`__version__`. Alternatively run the workflow by hand from the Actions tab with
"publish" ticked.

### First launch: unsigned app warnings

The builds are not code-signed, so the operating system warns the first time:

- **Windows** shows "Windows protected your PC" (SmartScreen): click **More info → Run anyway**.
- **macOS** shows "Apple could not verify pyhttp is free of malware": click **Done**,
  open **System Settings → Privacy & Security**, scroll down and click **Open Anyway**
  next to pyhttp (right-click → Open no longer works on macOS 15). Or clear the
  quarantine flag once, which also fixes "the app is damaged":
  `xattr -dr com.apple.quarantine /Applications/pyhttp.app`. The in-app updater
  clears it itself after a Homebrew update; a `brew upgrade` run in Terminal does not.

Removing these warnings needs a Windows code-signing certificate and an Apple
Developer ID (with notarization).

## Architecture

```
pyhttp/
  __main__.py     entry point: native window (pywebview) or browser/server mode
  app.py          FastAPI routes (/api/...) + static UI
  db.py           SQLite access (requests, folders, environments, cookies, history, runs); one
                  Database object per open project, see db.using()
  runner.py       httpx execution (auth, cookies, redirects, proxy, body types), RunManager, file output
  mock.py         mock servers: route matching and templated answers under /mock/<name>/
  gitsync.py      Git sync: definitions as JSON files, commit / pull / push, reading changes back
  wsclient.py     WebSocket client (handshake and framing on asyncio streams) behind the console
  secretstore.py  secret values in the OS credential store (Credential Manager, Keychain, Secret Service)
  docs.py         documentation export: Markdown, and the same as a standalone HTML page
  templating.py   {{variable}}, {{prev.*}}, {{data.*}} and {{$dynamic}} substitution
  jsonc.py        strips // and /* */ comments from JSON bodies
  assertions.py   code-free tests and value extraction
  jsengine.py     JavaScript scripts (Postman-compatible pm API) in QuickJS or V8; pm.js is the runtime
  scripts.py      optional Python pre-request / test scripts (py object)
  postman.py      Postman Collection v2.1 and environment import/export
  curl.py         curl command line -> request
  updater.py      in-app updates: download + verify + helper script (Windows), brew upgrade (macOS)
  static/         index.html, style.css, features.css, app.js, editor.js (CodeMirror editors),
                  viewer.js (response viewer), codegen.js (snippets), features.js,
                  flows.js + flows.css (the Flows section), pages.js + pages.css (the Monitors
                  and Mocks sections), ui.css (the look: colors, density,
                  the navigation rail; loaded last, its rules are written at its top),
                  vendor/codemirror.js (prebuilt CodeMirror 6 bundle, see packaging/editor)
packaging/        build.py, pyhttp.spec, pyhttp.iss (Windows installer), make_icons.py (desktop builds)
tests/            test_backend.py (API), test_ui.py (Playwright, headless Edge/Chromium)
```

Run the tests with `pip install -r requirements-dev.txt` and `python -m pytest tests -q`.

In `--browser` or `--server` mode the API is documented at
<http://127.0.0.1:8765/api/docs>, so you can drive runs from scripts
(`POST /api/runs`). Window mode uses the same default port when it is free and
falls back to any free one, printing it on start — so mock server URLs stay the
same from launch to launch.

## License

Copyright (c) 2026 pyhttp Dev Team — *From the unknown to the unowned*. pyhttp is **free for everyone** under the
[pyhttp Free License 1.1](LICENSE.md): at home or at work, at a company of any
size, for any purpose including commercial use, with no fees, no seats and no
registration. Unmodified release files may be shared freely, inside a company
or through package managers; selling pyhttp or distributing modified versions
is not allowed, and the name and logo stay with the project. The source code is
published on PyPI as [`pyhttp-app`](https://pypi.org/project/pyhttp-app/)
so it can be inspected and installed with pip; you may modify your own copy but
not distribute the changes. The packaged installer, `.exe`, `.dmg` and `.deb`
builds are published on this repository's
[Releases](https://github.com/pyhttp2/pyhttp/releases) page (the old
`pyhttp-releases` repository is no longer updated; every install checks here).
Bundled open-source components are listed in
[THIRD-PARTY-NOTICES.md](THIRD-PARTY-NOTICES.md).

Postman is a trademark of Postman, Inc. pyhttp is an independent project and is
not affiliated with or endorsed by Postman, Inc.; the name is used only to
describe compatibility (importing Postman collections, running Postman-style
scripts).

The app itself stays free. If paid extras ever appear, they will be optional
add-ons, services or support under their own terms, never a restriction on who
may use pyhttp.

## Keyboard shortcuts

| Keys            | Action        |
|-----------------|---------------|
| Ctrl/Cmd+Enter  | Send request  |
| Ctrl/Cmd+S      | Save now (autosave is always on) |
| Ctrl/Cmd+N      | New request   |
| Ctrl/Cmd+D      | Duplicate the request |
| Ctrl/Cmd+W      | Close the current tab |
| Ctrl/Cmd+K      | Search the collection |
| Ctrl/Cmd+/      | Comment / uncomment the line(s) in the body |
| Ctrl/Cmd+B      | Beautify the body |
| Tab / Shift+Tab | Indent / outdent in the body |
| Ctrl/Cmd+F      | Search in the response body |
| Ctrl/Cmd+Shift+C | Code snippet |
| Ctrl/Cmd+Alt+C  | Toggle the console |
| Ctrl/Cmd+\      | Show or hide the sidebar |
| ?               | Shortcut help |
| Esc             | Close dialog  |
