Merge branch 'develop' of https://github.com/jbrendel/requests into develop

Conflicts:
	AUTHORS
	requests/__init__.py
This commit is contained in:
Kenneth Reitz
2011-11-09 22:15:54 -08:00
5 changed files with 29 additions and 5 deletions
+2 -1
View File
@@ -50,4 +50,5 @@ Patches and Suggestions
- Dan Head
- Bruno Renié
- David Fischer
- Joseph McCullough
- Joseph McCullough
- Juergen Brendel
+1 -1
View File
@@ -24,7 +24,7 @@ __copyright__ = 'Copyright 2011 Kenneth Reitz'
from . import utils
from .models import Request, Response
from .api import request, get, head, post, patch, put, delete
from .api import request, get, head, post, patch, put, delete, options
from .sessions import session, Session
from .status_codes import codes
from .exceptions import (
+12 -1
View File
@@ -13,7 +13,7 @@ This module implements the Requests API.
from .sessions import session
__all__ = ('request', 'get', 'head', 'post', 'patch', 'put', 'delete')
__all__ = ('request', 'get', 'options', 'head', 'post', 'patch', 'put', 'delete')
def request(method, url,
@@ -68,6 +68,17 @@ def get(url, **kwargs):
return request('GET', url, **kwargs)
def options(url, **kwargs):
"""Sends a OPTIONS request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param **kwargs: Optional arguments that ``request`` takes.
"""
kwargs.setdefault('allow_redirects', True)
return request('OPTIONS', url, **kwargs)
def head(url, **kwargs):
"""Sends a HEAD request. Returns :class:`Response` object.
+2 -1
View File
@@ -24,7 +24,7 @@ from .hooks import dispatch_hook
__all__ = (
'map',
'get', 'head', 'post', 'put', 'patch', 'delete', 'request'
'get', 'options', 'head', 'post', 'put', 'patch', 'delete', 'request'
)
@@ -54,6 +54,7 @@ def send(r, pools=None):
# Patched requests.api functions.
get = patched(api.get)
options = patched(api.options)
head = patched(api.head)
post = patched(api.post)
put = patched(api.put)
+12 -1
View File
@@ -199,6 +199,17 @@ class Session(object):
return self.request('GET', url, **kwargs)
def options(self, url, **kwargs):
"""Sends a OPTIONS request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param **kwargs: Optional arguments that ``request`` takes.
"""
kwargs.setdefault('allow_redirects', True)
return self.request('OPTIONS', url, **kwargs)
def head(self, url, **kwargs):
"""Sends a HEAD request. Returns :class:`Response` object.
@@ -257,4 +268,4 @@ class Session(object):
def session(**kwargs):
"""Returns a :class:`Session` for context-management."""
return Session(**kwargs)
return Session(**kwargs)