Skip to content
Merged
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 CHANGES/10795.doc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Replaced the deprecated ``ujson`` library with ``orjson`` in the
client quickstart documentation. ``ujson`` has been put into
maintenance-only mode; ``orjson`` is the recommended alternative.
-- by :user:`indoor47`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will render poorly, it should've been on a separate line.

16 changes: 9 additions & 7 deletions docs/client_quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -206,20 +206,22 @@ Any of session's request methods like :func:`request`,


By default session uses python's standard :mod:`json` module for
serialization. But it is possible to use different
``serializer``. :class:`ClientSession` accepts ``json_serialize``
parameter::
serialization. But it is possible to use a different
``serializer``. :class:`ClientSession` accepts ``json_serialize`` and
``json_serialize_bytes`` parameters::

import ujson
import orjson

async with aiohttp.ClientSession(
json_serialize=ujson.dumps) as session:
json_serialize_bytes=orjson.dumps) as session:
await session.post(url, json={'test': 'object'})

.. note::

``ujson`` library is faster than standard :mod:`json` but slightly
incompatible.
``orjson`` library is faster than standard :mod:`json` and is actively
maintained. Since ``orjson.dumps`` returns :class:`bytes`, pass it via
the ``json_serialize_bytes`` parameter to avoid unnecessary
encoding/decoding overhead.

JSON Response Content
=====================
Expand Down
1 change: 1 addition & 0 deletions docs/spelling_wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ pytest
Pytest
qop
Quickstart
quickstart
quote’s
rc
readline
Expand Down
Loading