Skip to content

Commit d2f6bde

Browse files
authored
Clarify decode_unicode behaviour in iter_{content,lines} docstrings (#7365)
1 parent a044b02 commit d2f6bde

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/requests/models.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -811,8 +811,10 @@ def iter_content(self, chunk_size=1, decode_unicode=False):
811811
chunks are received. If stream=False, data is returned as
812812
a single chunk.
813813
814-
If decode_unicode is True, content will be decoded using the best
815-
available encoding based on the response.
814+
If decode_unicode is True, content will be decoded using encoding
815+
information from the response. If no encoding information is available,
816+
bytes will be returned. This can be bypassed by manually setting
817+
`encoding` on the response.
816818
"""
817819

818820
def generate():
@@ -863,6 +865,9 @@ def iter_lines(
863865
stream=True is set on the request, this avoids reading the
864866
content at once into memory for large responses.
865867
868+
The decode_unicode param works the same as in `iter_content`, with the
869+
same caveats.
870+
866871
.. note:: This method is not reentrant safe.
867872
"""
868873

0 commit comments

Comments
 (0)