Skip to content

Commit c8f2acb

Browse files
committed
Rephrase the body feature entry.
1 parent 3cc4711 commit c8f2acb

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

NEWS

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ History
99
* Add support for JMESPath: you can now create a selector for a JSON document
1010
and call ``Selector.jmespath()``. See :ref:`the documentation
1111
<topics-selectors>` for more information and examples.
12-
* Memory usage improvements
12+
* Selectors can now be constructed from ``bytes`` (using the ``body`` and
13+
``encoding`` arguments) instead of ``str`` (using the ``text`` argument), so
14+
that there is no internal conversion from ``str`` to ``bytes`` and the memory
15+
usage is lower.
1316
* Typing improvements
1417
* The ``pkg_resources`` module (which was absent from the requirements) is no
1518
longer used

parsel/selector.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,10 @@ class Selector:
416416
You can write selection expressions in CSS or XPath for HTML and XML
417417
inputs, or in JMESPath for JSON inputs.
418418
419-
``text`` is a `str`` object.
419+
``text`` is an ``str`` object.
420+
421+
``body`` is a ``bytes`` object. It can be used together with the
422+
``encoding`` argument instead of the ``text`` argument.
420423
421424
``type`` defines the selector type. It can be ``"html"`` (default),
422425
``"json"``, or ``"xml"``.

0 commit comments

Comments
 (0)