Skip to content

Commit

Permalink
renamed multipart_files to files
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenneth Reitz committed Feb 14, 2011
1 parent e89eba7 commit 324c572
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions requests/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class Request(object):
def __init__(self):
self.url = None
self.headers = dict()
self.multipart_files = None
self.files = None
self.method = None
self.params = {}
self.data = {}
Expand Down Expand Up @@ -149,9 +149,9 @@ def send(self, anyway=False):
elif self.method == 'PUT':
if (not self.sent) or anyway:

if self.multipart_files:
if self.files:
register_openers()
datagen, headers = multipart_encode(self.multipart_files)
datagen, headers = multipart_encode(self.files)
req = _Request(self.url, data=datagen, headers=headers, method='PUT')

if self.headers:
Expand Down Expand Up @@ -184,9 +184,9 @@ def send(self, anyway=False):
elif self.method == 'POST':
if (not self.sent) or anyway:

if self.multipart_files:
if self.files:
register_openers()
datagen, headers = multipart_encode(self.multipart_files)
datagen, headers = multipart_encode(self.files)
req = _Request(self.url, data=datagen, headers=headers, method='POST')

if self.headers:
Expand Down Expand Up @@ -301,13 +301,13 @@ def head(url, params={}, headers={}, auth=None):
return r.response


def post(url, data={}, headers={}, multipart_files=None, auth=None):
def post(url, data={}, headers={}, files=None, auth=None):
"""Sends a POST request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary of POST Data to send with the :class:`Request`.
:param headers: (optional) Dictionary of HTTP Headers to sent with the :class:`Request`.
:param multipart_files: (optional) Dictoinary of 'filename': file-like-objects for multipart encoding upload.
:param files: (optional) Dictionary of 'filename': file-like-objects for multipart encoding upload.
:param auth: (optional) AuthObject to enable Basic HTTP Auth.
"""

Expand All @@ -317,8 +317,8 @@ def post(url, data={}, headers={}, multipart_files=None, auth=None):
r.method = 'POST'
r.data = data

if multipart_files:
r.multipart_files = multipart_files
if files:
r.files = files

r.headers = headers
r.auth = _detect_auth(url, auth)
Expand All @@ -328,13 +328,13 @@ def post(url, data={}, headers={}, multipart_files=None, auth=None):
return r.response


def put(url, data='', headers={}, multipart_files={}, auth=None):
def put(url, data='', headers={}, files={}, auth=None):
"""Sends a PUT request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Bytes of PUT Data to send with the :class:`Request`.
:param headers: (optional) Dictionary of HTTP Headers to sent with the :class:`Request`.
:param multipart_files: (optional) Dictoinary of 'filename': file-like-objects for multipart encoding upload.
:param files: (optional) Dictionary of 'filename': file-like-objects for multipart encoding upload.
:param auth: (optional) AuthObject to enable Basic HTTP Auth.
"""

Expand All @@ -343,7 +343,7 @@ def put(url, data='', headers={}, multipart_files={}, auth=None):
r.url = url
r.method = 'PUT'
r.data = data

r.files = files
r.headers = headers
r.auth = _detect_auth(url, auth)

Expand Down

0 comments on commit 324c572

Please sign in to comment.