renamed multipart_files to files
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Kenneth Reitz · committed by Kenneth Reitz · parent e89eba7 · Browse files · 1 file·+12 added−12 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+12 added−12 removed
- other:+12 added−12 removed
Provenance
- Commit
324c572- Tree
5648003- Author
Kenneth Reitz <me@kennethreitz.com>- Committer
Kenneth Reitz <me@kennethreitz.com>- Parent
e89eba7
1 file changed+12 added−12 removed
modified:requests/core.py+12 added-12 removed
52 unmodified lines53 54 def __init__(self):55 self.url = None56 self.headers = dict()57- self.multipart_files = None57+ self.files = None58 self.method = None59 self.params = {}60 self.data = {}61 self.response = Response()86 unmodified lines148 149 elif self.method == 'PUT':150 if (not self.sent) or anyway:151 152- if self.multipart_files:152+ if self.files:153 register_openers()154- datagen, headers = multipart_encode(self.multipart_files)154+ datagen, headers = multipart_encode(self.files)155 req = _Request(self.url, data=datagen, headers=headers, method='PUT')156 157 if self.headers:158 req.headers.update(self.headers)24 unmodified lines183 184 elif self.method == 'POST':185 if (not self.sent) or anyway:186 187- if self.multipart_files:187+ if self.files:188 register_openers()189- datagen, headers = multipart_encode(self.multipart_files)189+ datagen, headers = multipart_encode(self.files)190 req = _Request(self.url, data=datagen, headers=headers, method='POST')191 192 if self.headers:193 req.headers.update(self.headers)106 unmodified lines300 301 return r.response302 303 304-def post(url, data={}, headers={}, multipart_files=None, auth=None):304+def post(url, data={}, headers={}, files=None, auth=None):305 """Sends a POST request. Returns :class:`Response` object.306 307 :param url: URL for the new :class:`Request` object.308 :param data: (optional) Dictionary of POST Data to send with the :class:`Request`.309 :param headers: (optional) Dictionary of HTTP Headers to sent with the :class:`Request`.310- :param multipart_files: (optional) Dictoinary of 'filename': file-like-objects for multipart encoding upload.310+ :param files: (optional) Dictionary of 'filename': file-like-objects for multipart encoding upload.311 :param auth: (optional) AuthObject to enable Basic HTTP Auth.312 """313 314 r = Request()1 unmodified line316 r.url = url317 r.method = 'POST'318 r.data = data319 320- if multipart_files:321- r.multipart_files = multipart_files320+ if files:321+ r.files = files322 323 r.headers = headers324 r.auth = _detect_auth(url, auth)325 1 unmodified line327 328 return r.response329 330 331-def put(url, data='', headers={}, multipart_files={}, auth=None):331+def put(url, data='', headers={}, files={}, auth=None):332 """Sends a PUT request. Returns :class:`Response` object.333 334 :param url: URL for the new :class:`Request` object.335 :param data: (optional) Bytes of PUT Data to send with the :class:`Request`.336 :param headers: (optional) Dictionary of HTTP Headers to sent with the :class:`Request`.337- :param multipart_files: (optional) Dictoinary of 'filename': file-like-objects for multipart encoding upload.337+ :param files: (optional) Dictionary of 'filename': file-like-objects for multipart encoding upload.338 :param auth: (optional) AuthObject to enable Basic HTTP Auth.339 """340 341 r = Request()342 343 r.url = url344 r.method = 'PUT'345 r.data = data346- 346+ r.files = files347 r.headers = headers348 r.auth = _detect_auth(url, auth)349 350 r.send()76 unmodified lines