Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added buffer_size parameter to http module #730

Merged
merged 1 commit into from
Oct 16, 2022
Merged
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
6 changes: 4 additions & 2 deletions smart_open/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def open_uri(uri, mode, transport_params):


def open(uri, mode, kerberos=False, user=None, password=None, cert=None,
headers=None, timeout=None):
headers=None, timeout=None, buffer_size=DEFAULT_BUFFER_SIZE):
"""Implement streamed reader from a web site.

Supports Kerberos and Basic HTTP authentication.
Expand All @@ -73,6 +73,8 @@ def open(uri, mode, kerberos=False, user=None, password=None, cert=None,
Any headers to send in the request. If ``None``, the default headers are sent:
``{'Accept-Encoding': 'identity'}``. To use no headers at all,
set this variable to an empty dict, ``{}``.
buffer_size: int, optional
The buffer size to use when performing I/O.

Note
----
Expand All @@ -82,7 +84,7 @@ def open(uri, mode, kerberos=False, user=None, password=None, cert=None,
"""
if mode == constants.READ_BINARY:
fobj = SeekableBufferedInputBase(
uri, mode, kerberos=kerberos,
uri, mode, buffer_size=buffer_size, kerberos=kerberos,
user=user, password=password, cert=cert,
headers=headers, timeout=timeout,
)
Expand Down