Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions httpx/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
"""
A next-generation HTTP client for Python.
"""

from .__version__ import __description__, __title__, __version__
from ._api import *
from ._auth import *
Expand Down
26 changes: 26 additions & 0 deletions httpx/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,19 @@ def __repr__(self) -> str:


class Request:
"""
An HTTP request.

Can be constructed explicitly for more control over exactly
what gets sent over the wire.

```python
>>> request = httpx.Request("GET", "https://example.org")
```

The keyword arguments mirror those of `Client.build_request()`.
"""

def __init__(
self,
method: str,
Expand Down Expand Up @@ -513,6 +526,19 @@ def __setstate__(self, state: dict[str, typing.Any]) -> None:


class Response:
"""
An HTTP response.

Returned by `Client` / `AsyncClient` requests or constructed
directly in tests and custom transports.

```python
>>> response = httpx.Response(200, json={"ok": True})
>>> response.status_code
200
```
"""

def __init__(
self,
status_code: int,
Expand Down
6 changes: 6 additions & 0 deletions tests/test_exported_members.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,9 @@ def test_all_imports_are_exported() -> None:
),
key=str.casefold,
)


def test_public_docstrings() -> None:
assert httpx.__doc__ and httpx.__doc__.strip()
assert httpx.Request.__doc__ and httpx.Request.__doc__.strip()
assert httpx.Response.__doc__ and httpx.Response.__doc__.strip()
Loading