Skip to main content

RESTful command line HTTP client (and simpler than cURL).

Project description

Just another command line HTTP client (in the spirit of cURL).

Example Usage

HTTP verbs are specified as a positional argument, followed by the URL to be acted on. The goal is to reflect the feel of a standard HTTP header. For example:

$ http get http://localhost/

To provide a request body (e.g. for a POST or PUT), use the third positional argument:

$ http post http://localhost/documents '{"json": "document"}'

Arbitrary request headers can be specified as CLI args:

$ http get http://localhost/ --x-forwarded-for=10.0.0.50

This would be translated as X-Forwarded-For: 10.0.0.50 in the subsequent HTTP request. To illustrate this, we can enable verbose output:

$ http --verbose get http://localhost/ --x-forwarded-for=10.0.0.50

GET http://localhost/
=====================

X-Forwarded-For: 10.0.0.50

200 OK
======

Status: 200
Content-Length: 396
Content-Location: http://localhost/
Date: Wed, 30 May 2012 19:26:03 GMT
Content-Type: application/json

{
  "documents": [
    {
      "id": "c1be0fde3c0f4d27be15e1e3812cfd65b58325c3",
      "value": "a"
    },
    {
      "id": "67dc85dceacd3734ae53f1a69f56785dfe4c4c71",
      "value": "b"
    }
  ]
}

Built-In Help

Example help output:

$ http --help
usage: http [-h] [-v] method url [body] ...

Python HTTP CLI Client

positional arguments:
method         HTTP method to use (OPTIONS, GET, HEAD, POST, PUT, DELETE,
                TRACE, CONNECT)
url            URL to work with
body           Request body
headers        Additional request headers (keyword=value)

optional arguments:
-h, --help     show this help message and exit
-v, --verbose  show verbose output

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

httpcli-1.2.0.tar.gz (3.3 kB view details)

Uploaded Source

File details

Details for the file httpcli-1.2.0.tar.gz.

File metadata

  • Download URL: httpcli-1.2.0.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for httpcli-1.2.0.tar.gz
Algorithm Hash digest
SHA256 ba95ff15249812efa00438c98607dd9a9096adedc0289ca85450675882107317
MD5 438dfdeeebc7c50adec226b4f2ddfeba
BLAKE2b-256 96045b5f68a163daec52108186f6492b3dd0124dcf1ec7ed8682be3d920483f9

See more details on using hashes here.

Supported by

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