Skip to content
Myr

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

1 file+12 added−12 removed

modified:requests/core.py+12 added-12 removed
52 unmodified lines
53 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 lines
148149 elif self.method == 'PUT':150 if (not self.sent) or anyway:151152 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')156157 if self.headers:158 req.headers.update(self.headers)
24 unmodified lines
183184 elif self.method == 'POST':185 if (not self.sent) or anyway:186187 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')191192 if self.headers:193 req.headers.update(self.headers)
106 unmodified lines
300 301 return r.response302303304def post(url, data={}, headers={}, multipart_files=None, auth=None):304def post(url, data={}, headers={}, files=None, auth=None):305 """Sends a POST request. Returns :class:`Response` object.306307 :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 line
316 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 line
327 328 return r.response329 330 331def put(url, data='', headers={}, multipart_files={}, auth=None):331def put(url, data='', headers={}, files={}, auth=None):332 """Sends a PUT request. Returns :class:`Response` object.333334 :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()342343 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