Skip to content

Commit

Permalink
simplify api.request
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenneth Reitz committed Dec 28, 2011
1 parent 31d495f commit a91ac24
Showing 1 changed file with 2 additions and 32 deletions.
34 changes: 2 additions & 32 deletions requests/api.py
Expand Up @@ -13,21 +13,7 @@

from . import sessions

def request(method, url,
params=None,
data=None,
headers=None,
cookies=None,
files=None,
auth=None,
timeout=None,
allow_redirects=False,
proxies=None,
hooks=None,
return_response=True,
prefetch=False,
session=None,
config=None):
def request(method, url, **kwargs):
"""Constructs and sends a :class:`Request <Request>`.
Returns :class:`Response <Response>` object.
Expand All @@ -48,23 +34,7 @@ def request(method, url,
"""

s = session or sessions.session()
return s.request(
method=method,
url=url,
params=params,
data=data,
headers=headers,
cookies=cookies,
files=files,
auth=auth,
timeout=timeout,
allow_redirects=allow_redirects,
proxies=proxies,
hooks=hooks,
return_response=return_response,
config=config,
prefetch=prefetch
)
return s.request(method=method, url=url, **kwargs)



Expand Down

3 comments on commit a91ac24

@kmike
Copy link

@kmike kmike commented on a91ac24 Dec 30, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please put such changes to HISTORY.rst or to upgrade guide? This change broke things because positional arguments are not longer supported for requests.request calls after this change.

@kennethreitz
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kmike, I've documented and suggested before that all arguments other than url and the like are to be treated as positional.

I'll add it to the HISTORY next time :)

@kmike
Copy link

@kmike kmike commented on a91ac24 Jan 5, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kennethreitz, thank you, I missed this!

Please sign in to comment.