Skip to content
This repository was archived by the owner on Oct 2, 2024. It is now read-only.

Commit 0123dcc

Browse files
committed
Allow sending file-like objects in send
1 parent 510e007 commit 0123dcc

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/onedrivesdk/request_base.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def append_option(self, option):
113113
elif isinstance(option, QueryOption):
114114
self._query_options[option.key] = option.value
115115

116-
def send(self, content=None, path=None):
116+
def send(self, content=None, path=None, data=None):
117117
"""Send the request using the client specified
118118
at request initialization
119119
@@ -122,6 +122,8 @@ def send(self, content=None, path=None):
122122
that will be sent
123123
path (str): Defaults to None, the local path of the file which
124124
will be sent
125+
data (file object): Defaults to none, the file object of the
126+
file which will be sent
125127
126128
Returns:
127129
:class:`HttpResponse<onedrivesdk.http_response.HttpResponse>`:
@@ -141,6 +143,12 @@ def send(self, content=None, path=None):
141143
self._headers,
142144
self.request_url,
143145
path=path)
146+
elif data:
147+
response = self._client.http_provider.send(
148+
self.method,
149+
self._headers,
150+
self.request_url,
151+
data=data)
144152
else:
145153
content_dict = None
146154

0 commit comments

Comments
 (0)