Skip to content
Myr

Added support for OPTIONS method.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by jbrendel · committed by jbrendel · parent 8c90c61 · Browse files · 5 files+29 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

5 files+29 added−5 removed

  • other:+29 added−5 removed

5 files+29 added−5 removed

modified:requests/__init__.py+1 added-1 removed
22 unmodified lines
232425from . import utils26from .models import Request, Response27from .api import request, get, head, post, patch, put, delete27from .api import request, get, options, head, post, patch, put, delete28from .sessions import session29from .status_codes import codes30from .exceptions import (31 RequestException, AuthenticationError, Timeout, URLRequired,
2 unmodified lines
modified:requests/api.py+12 added-1 removed
11 unmodified lines
12"""1314from .sessions import session1516__all__ = ('request', 'get', 'head', 'post', 'patch', 'put', 'delete')16__all__ = ('request', 'get', 'options', 'head', 'post', 'patch', 'put', 'delete')171819def request(method, url,20 params=None,
45 unmodified lines
66 kwargs.setdefault('allow_redirects', True)67 return request('GET', url, **kwargs)686970def options(url, **kwargs):71 """Sends a OPTIONS request. Returns :class:`Response` object.7273 :param url: URL for the new :class:`Request` object.74 :param **kwargs: Optional arguments that ``request`` takes.75 """7677 kwargs.setdefault('allow_redirects', True)78 return request('OPTIONS', url, **kwargs)798081def head(url, **kwargs):82 """Sends a HEAD request. Returns :class:`Response` object.8384 :param url: URL for the new :class:`Request` object.
48 unmodified lines
modified:requests/async.py+2 added-1 removed
22 unmodified lines
232425__all__ = (26 'map',27 'get', 'head', 'post', 'put', 'patch', 'delete', 'request'27 'get', 'options', 'head', 'post', 'put', 'patch', 'delete', 'request'28)293031def patched(f):
20 unmodified lines
525354# Patched requests.api functions.55get = patched(api.get)56options = patched(api.options)57head = patched(api.head)58post = patched(api.post)59put = patched(api.put)60patch = patched(api.patch)
22 unmodified lines
modified:requests/sessions.py+12 added-1 removed
186 unmodified lines
187 kwargs.setdefault('allow_redirects', True)188 return self.request('GET', url, **kwargs)189190191 def options(self, url, **kwargs):192 """Sends a OPTIONS request. Returns :class:`Response` object.193194 :param url: URL for the new :class:`Request` object.195 :param **kwargs: Optional arguments that ``request`` takes.196 """197198 kwargs.setdefault('allow_redirects', True)199 return self.request('OPTIONS', url, **kwargs)200201202 def head(self, url, **kwargs):203 """Sends a HEAD request. Returns :class:`Response` object.204205 :param url: URL for the new :class:`Request` object.
50 unmodified lines
256257def session(**kwargs):258 """Returns a :class:`Session` for context-management."""259249 return Session(**kwargs)260 return Session(**kwargs)
modified:AUTHORS+2 added-1 removed
47 unmodified lines
48- Fredrik Möllerstrand49- Daniel Hengeveld50- Dan Head51- Bruno Renié52- David Fischer52- David Fischer53- Juergen Brendel