Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A dead simple abstraction of HTTP for Python.

branch: master

Merge pull request #2 from thedufer/master

Allow setting cookies with dicts
latest commit c9ea5c40dc
Adeel Ahmad Khan authored
Octocat-spinner-32 pump allow setting cookies with dict August 02, 2011
Octocat-spinner-32 .gitignore Initial commit. March 24, 2011
Octocat-spinner-32 LICENSE update readme, specs and license July 26, 2011
Octocat-spinner-32 add link to spec in readme July 26, 2011
Octocat-spinner-32 minor July 26, 2011
Octocat-spinner-32 add Beaker dependency July 29, 2011

Pump User Manual

Pump is a dead simple abstraction of HTTP for Python.


The Pump specification consists of headers, requests, responses, apps, and middleware. Below are examples of each.

Pump requests.

{"server_port": "80",
 "server_name": "",
 "remote_addr": "",
 "uri": "/",
 "scheme": "http",
 "method": "get",
   {"accept_charset": "ISO-8859-1,utf-8;q=0.7,*;q=0.3",
    "connection": "keep-alive",
    "host": "localhost:8000",

Pump responses.

{"status": 200,
 "headers": {"content_type": "text/plain"},
 "body": "Hello!"}

Pump apps.

def app(req):
  if req["uri"] == "/favicon.ico":
    return {"status": 404, headers: {}, body: "Not Found"}
  return {"status": 200,
          "headers": {"content_type": "text/html"},
          "body": "<h1>Hello!</h1>"}

Pump middleware.

def wrap_with_logger(app):
  def wrapped(req):
    response = app(req)
    print "%s %s\n  => %s" % (req["method"],
    return response
  return wrapped

For the detailed specification, see

Getting started


To install, type

$ pip install pump

or grab the code from Github:

$ git clone git://
$ cd pump
$ python install

Running your app

Pump comes with an adapter for the Paste WSGI server. If you don't have that installed, do

$ pip install Paste

and then to run your app:

import pump
pump.adapters.serve_with_paste(app, {"port": 3000})

Soon, Pump will come with adapters for other popular WSGI servers.


Pump was heavily inspired by Clojure's Ring. Thanks, Mark McGranaghan!


Copyright (c) 2011 Adeel Ahmad Khan

MIT license.

Something went wrong with that request. Please try again.