Skip to content

v0.1.0

Latest

Choose a tag to compare

@github-actions github-actions released this 15 Oct 02:44

The first release of pathapi-requests: RequestsTransport, the HTTP
transport that sends through a requests.Session, as a distribution of its own.
It needs Python 3.9 or newer, pathapi>=0.1.0,<0.2 and
requests>=2.22.0,<3; its one extra, socks, adds requests[socks] for SOCKS
proxies. Under Changed, the migration from the RequestsTransport of
pathlib-next comes in this order: the table of names, then every change of
behaviour with what to do about it.

It is built on pathapi, which was published as pathlib-next up to 0.10.0 (import
name pathlib_next); the old names below are the ones before the move.

Added

  • pathapi_requests.RequestsTransport and pathapi_requests.__version__.
  • The distribution declares the requests entry of the
    pathapi.http_transports group. Installing it is all that
    pathapi.http needs to send through it:
    HTTPClient(RequestsTransport(session)) and
    PATHAPI_HTTP_TRANSPORT=requests use it,
    pathapi.http.get_transport("requests") loads it, and
    pathapi.http.transport_names() lists it.
  • RequestsTransport(proxies=provider): an object indexed with the request URL
    that answers a proxy (a URL, or an object with a url), None for no proxy,
    or an iterable of them, of which the first is used. KeyError leaves the
    decision to requests.
  • A session the transport made is closed when the transport is collected, and a
    response that is still open keeps its transport alive, so a dropped transport
    leaves no sockets to the garbage collector on any urllib3.
  • A socks4:, socks5: or socks5h: proxy without PySocks raises
    OSError(EPROTONOSUPPORT) naming pathapi-requests[socks].
  • The tests pathapi runs over its own transport run over this one
    (python -m pathapi.http.testing --http-transports requests) as part of
    the test suite.

Changed

  • Migration from pathlib-next:

    Was Is
    pathlib_next.uri.schemes.http.RequestsTransport pathapi_requests.RequestsTransport
    RequestsTransport(session=None, **requests_args) RequestsTransport(session=None, *, proxies=None, **requests_args)
    the extra pathlib-next[http] pip install pathapi-requests
    PATHLIB_NEXT_HTTP_TRANSPORT=requests the same, read by pathapi.http; this distribution must be installed
  • proxies is a provider and no longer an argument that requests receives as
    it is. A dict keeps its requests meaning for the keys "http", "https",
    "all" and "scheme://host" (a None value is still no proxy); a
    "no_proxy" entry of the dict is not read. What to do: put NO_PROXY in the
    environment, or answer None for those URLs.

  • A requests that cannot be imported raises an ImportError that names this
    distribution, where it named the http extra of pathlib-next. What to do:
    reinstall pathapi-requests.

  • A session that is not an object with a request() method raises
    TypeError where the transport is built. What to do: pass a
    requests.Session.

Full Changelog: https://github.com/jose-pr/pathapi-requests/commits/v0.1.0