experimental/cuda-ubi9/: httpcore-1.0.5 metadata and description

Simple index

A minimal low-level HTTP client.

author_email Tom Christie <tom@tomchristie.com>
classifiers
  • Development Status :: 3 - Alpha
  • Environment :: Web Environment
  • Framework :: AsyncIO
  • Framework :: Trio
  • Intended Audience :: Developers
  • License :: OSI Approved :: BSD License
  • Operating System :: OS Independent
  • Programming Language :: Python :: 3
  • Programming Language :: Python :: 3 :: Only
  • Programming Language :: Python :: 3.8
  • Programming Language :: Python :: 3.9
  • Programming Language :: Python :: 3.10
  • Programming Language :: Python :: 3.11
  • Programming Language :: Python :: 3.12
  • Topic :: Internet :: WWW/HTTP
description_content_type text/markdown
project_urls
  • Documentation, https://www.encode.io/httpcore
  • Homepage, https://www.encode.io/httpcore/
  • Source, https://github.com/encode/httpcore
provides_extras trio
requires_dist
  • certifi
  • h11<0.15,>=0.13
  • anyio<5.0,>=4.0; extra == 'asyncio'
  • h2<5,>=3; extra == 'http2'
  • socksio==1.*; extra == 'socks'
  • trio<0.26.0,>=0.22.0; extra == 'trio'
requires_python >=3.8
File Tox results History
httpcore-1.0.5-py3-none-any.whl
Size
76 KB
Type
Python Wheel
Python
3

HTTP Core

Test Suite Package version

Do one thing, and do it well.

The HTTP Core package provides a minimal low-level HTTP client, which does one thing only. Sending HTTP requests.

It does not provide any high level model abstractions over the API, does not handle redirects, multipart uploads, building authentication headers, transparent HTTP caching, URL parsing, session cookie handling, content or charset decoding, handling JSON, environment based configuration defaults, or any of that Jazz.

Some things HTTP Core does do:

Requirements

Python 3.8+

Installation

For HTTP/1.1 only support, install with:

$ pip install httpcore

There are also a number of optional extras available...

$ pip install httpcore['asyncio,trio,http2,socks']

Sending requests

Send an HTTP request:

import httpcore

response = httpcore.request("GET", "https://www.example.com/")

print(response)
# <Response [200]>
print(response.status)
# 200
print(response.headers)
# [(b'Accept-Ranges', b'bytes'), (b'Age', b'557328'), (b'Cache-Control', b'max-age=604800'), ...]
print(response.content)
# b'<!doctype html>\n<html>\n<head>\n<title>Example Domain</title>\n\n<meta charset="utf-8"/>\n ...'

The top-level httpcore.request() function is provided for convenience. In practice whenever you're working with httpcore you'll want to use the connection pooling functionality that it provides.

import httpcore

http = httpcore.ConnectionPool()
response = http.request("GET", "https://www.example.com/")

Once you're ready to get going, head over to the documentation.

Motivation

You probably don't want to be using HTTP Core directly. It might make sense if you're writing something like a proxy service in Python, and you just want something at the lowest possible level, but more typically you'll want to use a higher level client library, such as httpx.

The motivation for httpcore is:

Dependencies

The httpcore package has the following dependencies...

And the following optional extras...

Versioning

We use SEMVER for our versioning policy.

For changes between package versions please see our project changelog.

We recommend pinning your requirements either the most current major version, or a more specific version range:

pip install 'httpcore==1.*'

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog.

1.0.5 (March 27th, 2024)

1.0.4 (February 21st, 2024)

1.0.3 (February 13th, 2024)

1.0.2 (November 10th, 2023)

1.0.1 (November 3rd, 2023)

1.0.0 (October 6th, 2023)

From version 1.0 our async support is now optional, as the package has minimal dependencies by default.

For async support use either pip install 'httpcore[asyncio]' or pip install 'httpcore[trio]'.

The project versioning policy is now explicitly governed by SEMVER. See https://semver.org/.

0.18.0 (September 8th, 2023)

0.17.3 (July 5th, 2023)

0.17.2 (May 23th, 2023)

0.17.1 (May 17th, 2023)

0.17.0 (March 16th, 2023)

0.16.3 (December 20th, 2022)

0.16.2 (November 25th, 2022)

0.16.1 (November 17th, 2022)

0.16.0 (October 11th, 2022)

0.15.0 (May 17th, 2022)

0.14.7 (February 4th, 2022)

0.14.6 (February 1st, 2022)

0.14.5 (January 18th, 2022)

0.14.4 (January 5th, 2022)

0.14.3 (November 17th, 2021)

0.14.2 (November 16th, 2021)

0.14.1 (November 12th, 2021)

0.14.0 (November 11th, 2021)

The 0.14 release is a complete reworking of httpcore, comprehensively addressing some underlying issues in the connection pooling, as well as substantially redesigning the API to be more user friendly.

Some of the lower-level API design also makes the components more easily testable in isolation, and the package now has 100% test coverage.

See discussion #419 for a little more background.

There's some other neat bits in there too, such as the "trace" extension, which gives a hook into inspecting the internal events that occur during the request/response cycle. This extension is needed for the HTTPX cli, in order to...

Note that curio support is not currently available in 0.14.0. If you're using httpcore with curio please get in touch, so we can assess if we ought to prioritize it as a feature or not.

0.13.7 (September 13th, 2021)

0.13.6 (June 15th, 2021)

Fixed

0.13.5 (June 14th, 2021)

Fixed

0.13.4 (June 9th, 2021)

Added

Fixed

0.13.3 (May 6th, 2021)

Added

Fixed

0.13.2 (April 29th, 2021)

Added

0.13.1 (April 28th, 2021)

Fixed

0.13.0 (April 21st, 2021)

The 0.13 release updates the core API in order to match the HTTPX Transport API, introduced in HTTPX 0.18 onwards.

An example of making requests with the new interface is:

with httpcore.SyncConnectionPool() as http:
    status_code, headers, stream, extensions = http.handle_request(
        method=b'GET',
        url=(b'https', b'example.org', 443, b'/'),
        headers=[(b'host', b'example.org'), (b'user-agent', b'httpcore')]
        stream=httpcore.ByteStream(b''),
        extensions={}
    )
    body = stream.read()
    print(status_code, body)

Changed

Added

Fixed

0.12.3 (December 7th, 2020)

Fixed

0.12.2 (November 20th, 2020)

Fixed

0.12.1 (November 7th, 2020)

Added

Fixed

0.12.0 (October 6th, 2020)

Changed

Added

Fixed

0.11.1 (September 28nd, 2020)

Fixed

0.11.0 (September 22nd, 2020)

The Transport API with 0.11.0 has a couple of significant changes.

Firstly we've moved changed the request interface in order to allow extensions, which will later enable us to support features such as trailing headers, HTTP/2 server push, and CONNECT/Upgrade connections.

The interface changes from:

def request(method, url, headers, stream, timeout):
    return (http_version, status_code, reason, headers, stream)

To instead including an optional dictionary of extensions on the request and response:

def request(method, url, headers, stream, ext):
    return (status_code, headers, stream, ext)

Having an open-ended extensions point will allow us to add later support for various optional features, that wouldn't otherwise be supported without these API changes.

In particular:

Currently extensions are limited to:

See https://github.com/encode/httpx/issues/1274#issuecomment-694884553 for the history behind this.

Secondly, the async version of request is now namespaced as arequest.

This allows concrete transports to support both sync and async implementations on the same class.

Added

Changed

0.10.2 (August 20th, 2020)

Added

Fixed

0.10.1 (August 7th, 2020)

0.10.0 (August 7th, 2020)

The most notable change in the 0.10.0 release is that HTTP/2 support is now fully optional.

Use either pip install httpcore for HTTP/1.1 support only, or pip install httpcore[http2] for HTTP/1.1 and HTTP/2 support.

Added

Changed

Fixed

0.9.1 (May 27th, 2020)

Fixed

0.9.0 (May 21th, 2020)

Changed

Fixed

0.8.4 (May 11th, 2020)

Added

Fixed

0.8.3 (May 6rd, 2020)

Fixed

0.8.2 (May 3rd, 2020)

Fixed

0.8.1 (April 30th, 2020)

Changed

0.8.0 (April 30th, 2020)

Fixed

### Added

0.7.0 (March 5th, 2020)