Skip to main content

Replay remote curl requests locally

Project description

localcurl

A tool to replay remote curl requests locally for easier debugging and testing.

Why use localcurl?

When debugging API issues or developing locally against a remote service, you often need to replay real requests from production or staging environments. localcurl makes it easy by automatically rewriting curl commands to point to your local service while preserving all headers, authentication, and other parameters.

Installation

With uv :

uv tool install localcurl

With pip :

pip install localcurl

NB: supports Python 3.9+

Usage

localcurl http://localhost:8080 curl https://api.example.com/endpoint

Or, as a shorthand:

lc http://localhost:8080 curl https://api.example.com/endpoint

The curl command can also be piped from stdin:

echo 'curl https://api.example.com/endpoint' | localcurl http://localhost:8080

Or read from the clipboard:

localcurl http://localhost:8080

Options

  • addrport: The local address to send the request to (e.g., http://localhost:8080)
  • --no-verify: Disable server TLS certificate verification
  • --keep-host-cookie-prefix: Prevent stripping __Host- prefix from cookies
  • --cookie: Add a cookie to the request (e.g. --cookie session=abc123)
  • --header: Add a header to the request (e.g. header 'Authorization: Bearer abc123')
  • --sid: Add a session cookie to request (shorthand for --cookie sessionid=). The cookie name can be overridden by setting a LC_SID_COOKIE_NAME environment variable.
  • --auth-token: Add an authentication header to request (shorthand for --header 'Authorization: Token ...'). The header name and prefix can be overridden by setting a LC_AUTH_TOKEN_HEADER environment variable (defaults to Authorization: Token).
  • curl_command: The curl command to parse (reads from stdin/clipboard if not provided)

Examples

Redirect an API request to your local service:

localcurl http://localhost:3000 'curl -H "Authorization: Bearer token123" https://api.example.com/users'

Ignore TLS verification for local development:

localcurl --no-verify https://localhost:8443 'curl https://api.example.com/secure-endpoint'

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

localcurl-0.4.0.tar.gz (31.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

localcurl-0.4.0-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file localcurl-0.4.0.tar.gz.

File metadata

  • Download URL: localcurl-0.4.0.tar.gz
  • Upload date:
  • Size: 31.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.2

File hashes

Hashes for localcurl-0.4.0.tar.gz
Algorithm Hash digest
SHA256 1f182f6e5d04effbaa6a674a1e6ea5c7b460756ac7f2fc1d71144be40aa9ee6b
MD5 e3f4288ff738344b802bc5e69648e239
BLAKE2b-256 1587185fb3ecc117332c69f955c8c04a63ed7666ef0dabafd77eca4fb2f554cc

See more details on using hashes here.

File details

Details for the file localcurl-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: localcurl-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.2

File hashes

Hashes for localcurl-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f0d1cdd263205fb6934f7546ad2d70fc9c19a99f8eceac36ef9582ea20a0b644
MD5 fb27525b7b7caa6ea898754933122064
BLAKE2b-256 5aff7ae1b9c5e03adfd8840fc7235854ada6a80ba70dc4f7463424374c3f96a1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page