Skip to content
Closed
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
2 changes: 1 addition & 1 deletion docs/connections.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,5 +139,5 @@ with httpx.open_connection("http://127.0.0.1:8080") as conn:
---

<span class="link-prev">← [Content Types](content-types.md)</span>
<span class="link-next">[Low Level Networking](networking.md) →</span>
<span class="link-next">[Parsers](parsers.md) →</span>
<span>&nbsp;</span>
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ The httpx 1.0 [design proposal](https://www.encode.io/httpnext/) is now availabl
* [Headers](docs/headers.md)
* [Content Types](docs/content-types.md)
* [Connections](docs/connections.md)
* [Parsers](docs/parsers.md)
* [Low Level Networking](docs/networking.md)
* [About](docs/about.md)

Expand Down
2 changes: 1 addition & 1 deletion docs/networking.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,6 @@ Custom network backends can also be used to provide functionality such as handli

---

<span class="link-prev">← [Connections](connections.md)</span>
<span class="link-prev">← [Parsers](parsers.md)</span>
<span class="link-next">[About](about.md) →</span>
<span>&nbsp;</span>
30 changes: 30 additions & 0 deletions docs/parsers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Parsers

```python
writer = io.BytesIO()
reader = io.BytesIO(
b"HTTP/1.1 200 OK\r\n"
b"Content-Length: 23\r\n"
b"Content-Type: application/json\r\n"
b"\r\n"
b'{"msg": "hello, world"}'
)
p = httpx.HTTPParser(writer, reader)

# Send the request...
p.send_method_line(b"GET", b"/", b"HTTP/1.1")
p.send_headers([(b"Host", b"example.com")])
p.send_body(b'')

# Receive the response...
protocol, code, reason_phase = p.recv_status_line()
headers = p.recv_headers()
body = b''
while buffer := p.recv_body():
body += buffer
```

---

<span class="link-prev">← [Connections](connections.md)</span>
<span class="link-next">[Low Level Networking](networking.md) →</span>
4 changes: 2 additions & 2 deletions docs/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="data:image/svg+xml,&lt;svg xmlns=&#39;http://www.w3.org/2000/svg&#39; viewBox=&#39;0 0 100 100&#39;&gt;&lt;text y=&#39;.9em&#39; font-size=&#39;90&#39;&gt;%F0%9F%8C%B1&lt;/text&gt;&lt;/svg&gt;">
<title>httpx</title>
<link rel="icon" href="data:image/svg+xml,&lt;svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'>&lt;text y='.9em' font-size='90'>🦋&lt;/text>&lt;/svg>">
<title>ʜᴛᴛᴘx</title>

<link rel="preconnect" href="https://fonts.googleapis.com/">
<link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin="">
Expand Down
1 change: 1 addition & 0 deletions scripts/docs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pages = {
'/headers': 'docs/headers.md',
'/content-types': 'docs/content-types.md',
'/connections': 'docs/connections.md',
'/parsers': 'docs/parsers.md',
'/networking': 'docs/networking.md',
'/about': 'docs/about.md',
}
Expand Down
1 change: 1 addition & 0 deletions scripts/unasync
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ unasync.unasync_files(
"src/ahttpx/_client.py",
"src/ahttpx/_content.py",
"src/ahttpx/_headers.py",
"src/ahttpx/_parsers.py",
"src/ahttpx/_pool.py",
"src/ahttpx/_quickstart.py",
"src/ahttpx/_response.py",
Expand Down
23 changes: 13 additions & 10 deletions src/ahttpx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from ._content import * # Content, File, Files, Form, HTML, JSON, MultiPart, Text
from ._headers import * # Headers
from ._network import * # NetworkBackend, NetworkStream, timeout
from ._parsers import * # HTTPParser, ProtocolError
from ._pool import * # Connection, ConnectionPool, Transport
from ._quickstart import * # get, post, put, patch, delete
from ._response import * # Response
Expand All @@ -18,35 +19,37 @@
"Connection",
"ConnectionPool",
"Content",
"delete",
"File",
"FileStream",
"Files",
"Form",
"get",
"Headers",
"HTML",
"HTTPParser",
"IterByteStream",
"JSON",
"MultiPart",
"NetworkBackend",
"NetworkStream",
"open_connection",
"post",
"put",
"patch",
"ProtocolError",
"Response",
"Request",
"serve_http",
"serve_tcp",
"Stream",
"Text",
"timeout",
"Transport",
"QueryParams",
"URL",
"delete",
"get",
"open_connection",
"patch",
"post",
"put",
"quote",
"serve_http",
"serve_tcp",
"timeout",
"unquote",
"URL",
"urldecode",
"urlencode",
]
Expand Down
2 changes: 1 addition & 1 deletion src/ahttpx/_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def encode(self) -> tuple[Stream, str]:
stream = ByteStream(str(self).encode("ascii"))
content_type = "application/x-www-form-urlencoded"
return (stream, content_type)

# Dict operations

def keys(self) -> typing.KeysView[str]:
Expand Down
Loading