This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

# Ultralite For when portability is critical, but you still need some HTTP convenience

## Author by Cathal Garvey, copyright 2014, proudly licensed under the [GNU Affero General Public License](

## About Anyone who’s coded in Python for long will have discovered [Kenneth Reitz’s “Requests” library](, which makes HTTP operations far more clean and straightforward than provided for by the Python standard library (though things are improving on that score).

Requests is as simple to install as pip install requests, and as pip comes installed with newer distributions of Python, this is really the best way you can get good HTTP in Python.

However, there are times when you want your code to be portable and not to depend on even the easiest third-party libraries, and for that there’s Ultralite.

The goal is to support 90% of the convenience of requests, while remaining short and in-lineable, so you can literally copy/paste all of the code in this module and drop it into your own code to get a taste of requests, anywhere. And all of this while passing flake8 and pyflakes.

## How do I use this? The intended use-case is to copy/paste this into your own modules or libraries. You can also use pip install ultralight to install for use in the interactive interpreter or to list it as a dependency in

When copy/pasting, just copy the entire Ultralite class from this module, and import the standard library modules it requires. Default headers can be added to the class attribute “_default_headers”; these will be added to all requests’ header dictionaries, with user-provided headers overwriting them.

At present this only supports HEAD and GET requests, but will handle POST/PUT/DELETE in the near future also in a manner similar to requests (enabled by improvements in the standard library).

Features provided that mimic requests:

  • Ultralite methods “get”/”head”/”put”/”post”/”delete” (not all implemented)
  • Methods return Ultralite.UltraliteResponse objects which are requests-like:
    • UltraliteResponse.headers -> dict
    • UltraliteResponse.status_code -> int
    • UltraliteResponse.reason -> str
    • UltraliteResponse.content -> bytes
    • UltraliteResponse.text -> unicode decoding of UltraliteResponse.content
    • UltraliteResponse.raw -> http.client.HTTPResponse / urllib.error.XXX
    • UltraliteResponse.request -> urllib.request.Request
    • UltraliteResponse.raise_for_status() -> Raise Ultralite.UltraliteError if http response code is not within 2XX range, otherwise do nothing.
    • UltraliteResponse.json() -> attempt json-decoding UltraliteResponse.text

## Does this depend on anything? Nope. This is valid pure-stdlib python as of Python 3.3+.

Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
ultralite-0.1.1.tar.gz (2.5 kB) Copy SHA256 Checksum SHA256 Source Sep 30, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting