Python HTTP APIs

Icon  Name                                     Description
[   ] __init__.py [   ] client.py Client APIs [   ] message.py Message constructs [   ] status.py Response status codes

Warning

This is experimental software; use at your own risk.

Installation

Place all of these files in a directory called "http" on your Python path. As this software matures, it will be available in a more polished package.

Use

For now, the most straightforward demonstration is the http.client.Dict class:

>>> from http.client import Dict
>>> web = Dict()
>>> apple = web['http://www.apple.com/']
>>> apple.__class__
<class http.message.Representation at 0x676c0>
>>> web['http://www.example.org/apple.html'] = apple
>>> del web['http://www.example.org/apple.html']
>>> new_apple = web['http://www.example.org/apple.html']
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "http/client.py", line 50, in __getitem__
    response = dereference(request)
  File "http/client.py", line 97, in dereference
    raise response
http.status.NotFound
>>>