mirror of
https://github.com/kennethreitz/requests.git
synced 2026-06-05 14:50:16 +00:00
-> types.Response
This commit is contained in:
+9
-9
@@ -11,9 +11,9 @@ This module implements the Requests API.
|
||||
"""
|
||||
|
||||
from . import sessions
|
||||
from . import types
|
||||
|
||||
|
||||
def request(method, url, session=None, **kwargs):
|
||||
def request(method: types.Method, url: types.URL, session: types.Session = None, **kwargs) -> types.Response:
|
||||
"""Constructs and sends a :class:`Request <Request>`.
|
||||
|
||||
:param method: method for the new :class:`Request` object.
|
||||
@@ -62,7 +62,7 @@ def request(method, url, session=None, **kwargs):
|
||||
return session.request(method=method, url=url, **kwargs)
|
||||
|
||||
|
||||
def get(url, params=None, **kwargs):
|
||||
def get(url: types.URL, params: types.Params = None, **kwargs) -> types.Response:
|
||||
r"""Sends a GET request.
|
||||
|
||||
:param url: URL for the new :class:`Request` object.
|
||||
@@ -76,7 +76,7 @@ def get(url, params=None, **kwargs):
|
||||
return request('get', url, params=params, **kwargs)
|
||||
|
||||
|
||||
def options(url, **kwargs):
|
||||
def options(url: types.URL, **kwargs) -> types.Response:
|
||||
r"""Sends an OPTIONS request.
|
||||
|
||||
:param url: URL for the new :class:`Request` object.
|
||||
@@ -89,7 +89,7 @@ def options(url, **kwargs):
|
||||
return request('options', url, **kwargs)
|
||||
|
||||
|
||||
def head(url, **kwargs):
|
||||
def head(url: types.URL, **kwargs) -> types.Response:
|
||||
r"""Sends a HEAD request.
|
||||
|
||||
:param url: URL for the new :class:`Request` object.
|
||||
@@ -102,7 +102,7 @@ def head(url, **kwargs):
|
||||
return request('head', url, **kwargs)
|
||||
|
||||
|
||||
def post(url, data=None, json=None, **kwargs):
|
||||
def post(url: types.URL, data: types.Data = None, json: types.JSON = None, **kwargs) -> types.Response:
|
||||
r"""Sends a POST request.
|
||||
|
||||
:param url: URL for the new :class:`Request` object.
|
||||
@@ -116,7 +116,7 @@ def post(url, data=None, json=None, **kwargs):
|
||||
return request('post', url, data=data, json=json, **kwargs)
|
||||
|
||||
|
||||
def put(url, data=None, **kwargs):
|
||||
def put(url: types.URL, data: types.Data = None, **kwargs) -> types.Response:
|
||||
r"""Sends a PUT request.
|
||||
|
||||
:param url: URL for the new :class:`Request` object.
|
||||
@@ -130,7 +130,7 @@ def put(url, data=None, **kwargs):
|
||||
return request('put', url, data=data, **kwargs)
|
||||
|
||||
|
||||
def patch(url, data=None, **kwargs):
|
||||
def patch(url: types.URL, data: types.Data = None, **kwargs) -> types.Response:
|
||||
r"""Sends a PATCH request.
|
||||
|
||||
:param url: URL for the new :class:`Request` object.
|
||||
@@ -144,7 +144,7 @@ def patch(url, data=None, **kwargs):
|
||||
return request('patch', url, data=data, **kwargs)
|
||||
|
||||
|
||||
def delete(url, **kwargs):
|
||||
def delete(url: types.URL, **kwargs) -> types.Response:
|
||||
r"""Sends a DELETE request.
|
||||
|
||||
:param url: URL for the new :class:`Request` object.
|
||||
|
||||
@@ -21,6 +21,7 @@ from http import cookiejar as cookielib
|
||||
from http.cookies import Morsel
|
||||
from io import StringIO
|
||||
|
||||
|
||||
builtin_str = str
|
||||
str = str
|
||||
bytes = bytes
|
||||
|
||||
+2
-1
@@ -1,11 +1,12 @@
|
||||
from typing import (
|
||||
Callable, Optional, Union, Any, Iterable, List, Mapping, MutableMapping,
|
||||
Tuple, IO, Text
|
||||
Tuple, IO, Text, Type
|
||||
)
|
||||
|
||||
from . import auth
|
||||
from .models import Response, PreparedRequest
|
||||
from .cookies import RequestsCookieJar
|
||||
from .sessions import Session
|
||||
|
||||
_ParamsMappingValueType = Union[str, bytes, int, float, Iterable[Union[str, bytes, int, float]]]
|
||||
Params = Optional[
|
||||
|
||||
Reference in New Issue
Block a user