@@ -513,7 +513,7 @@ The client session supports the context manager protocol for self closing.
513
513
.. versionadded :: 3.0
514
514
515
515
:param str server_hostname: Sets or overrides the host name that the
516
- target server’ s certificate will be matched against.
516
+ target server' s certificate will be matched against.
517
517
518
518
See :py:meth: `asyncio.loop.create_connection ` for more information.
519
519
@@ -850,14 +850,21 @@ certification chaining.
850
850
851
851
.. function :: request(method, url, *, params=None, data=None, \
852
852
json=None,\
853
- headers=None, cookies =None, auth=None, \
853
+ cookies=None, headers=None, skip_auto_headers =None, auth=None, \
854
854
allow_redirects=True, max_redirects=10, \
855
- encoding='utf-8', \
856
- version=HttpVersion(major=1, minor=1), \
857
- compress=None, chunked=None, expect100=False, raise_for_status=False, \
855
+ compress=False, chunked=None, expect100=False, raise_for_status=None, \
856
+ read_until_eof=True, \
857
+ proxy=None, proxy_auth=None, \
858
+ timeout=sentinel, ssl=True, \
859
+ server_hostname=None, \
860
+ proxy_headers=None, \
861
+ trace_request_ctx=None, \
858
862
read_bufsize=None, \
859
- connector=None, loop=None,\
860
- read_until_eof=True, timeout=sentinel)
863
+ auto_decompress=None, \
864
+ max_line_size=None, \
865
+ max_field_size=None, \
866
+ version=aiohttp.HttpVersion11, \
867
+ connector=None)
861
868
:async:
862
869
863
870
Asynchronous context manager for performing an asynchronous HTTP
@@ -870,8 +877,20 @@ certification chaining.
870
877
be encoded with :class: `~yarl.URL ` (see :class: `~yarl.URL `
871
878
to skip encoding).
872
879
873
- :param dict params: Parameters to be sent in the query
874
- string of the new request (optional)
880
+ :param params: Mapping, iterable of tuple of *key */*value * pairs or
881
+ string to be sent as parameters in the query
882
+ string of the new request. Ignored for subsequent
883
+ redirected requests (optional)
884
+
885
+ Allowed values are:
886
+
887
+ - :class: `collections.abc.Mapping ` e.g. :class: `dict `,
888
+ :class: `multidict.MultiDict ` or
889
+ :class: `multidict.MultiDictProxy `
890
+ - :class: `collections.abc.Iterable ` e.g. :class: `tuple ` or
891
+ :class: `list `
892
+ - :class: `str ` with preferably url-encoded content
893
+ (**Warning: ** content will not be encoded by *aiohttp *)
875
894
876
895
:param data: The data to send in the body of the request. This can be a
877
896
:class: `FormData ` object or anything that can be passed into
@@ -881,28 +900,46 @@ certification chaining.
881
900
:param json: Any json compatible python object (optional). *json * and *data *
882
901
parameters could not be used at the same time.
883
902
903
+ :param dict cookies: HTTP Cookies to send with the request (optional)
904
+
884
905
:param dict headers: HTTP Headers to send with the request (optional)
885
906
886
- :param dict cookies: Cookies to send with the request (optional)
907
+ :param skip_auto_headers: set of headers for which autogeneration
908
+ should be skipped.
909
+
910
+ *aiohttp * autogenerates headers like ``User-Agent `` or
911
+ ``Content-Type `` if these headers are not explicitly
912
+ passed. Using ``skip_auto_headers `` parameter allows to skip
913
+ that generation.
914
+
915
+ Iterable of :class: `str ` or :class: `~multidict.istr `
916
+ (optional)
887
917
888
918
:param aiohttp.BasicAuth auth: an object that represents HTTP Basic
889
919
Authorization (optional)
890
920
891
921
:param bool allow_redirects: Whether to process redirects or not.
892
- When ``True ``, redirects are followed (up to ``max_redirects `` times)
893
- and logged into :attr: `ClientResponse.history ` and ``trace_configs ``.
894
- When ``False ``, the original response is returned.
895
- ``True `` by default (optional).
922
+ When ``True ``, redirects are followed (up to ``max_redirects `` times)
923
+ and logged into :attr: `ClientResponse.history ` and ``trace_configs ``.
924
+ When ``False ``, the original response is returned.
925
+ ``True `` by default (optional).
896
926
897
- :param aiohttp.protocol.HttpVersion version: Request HTTP version (optional)
927
+ :param int max_redirects: Maximum number of redirects to follow.
928
+ :exc: `TooManyRedirects ` is raised if the number is exceeded.
929
+ Ignored when ``allow_redirects=False ``.
930
+ ``10 `` by default.
898
931
899
932
:param bool compress: Set to ``True `` if request has to be compressed
900
- with deflate encoding.
901
- `` False `` instructs aiohttp to not compress data .
933
+ with deflate encoding. If ` compress ` can not be combined
934
+ with a * Content-Encoding * and * Content-Length * headers .
902
935
``None `` by default (optional).
903
936
904
937
:param int chunked: Enables chunked transfer encoding.
905
- ``None `` by default (optional).
938
+ It is up to the developer
939
+ to decide how to chunk data streams. If chunking is enabled, aiohttp
940
+ encodes the provided chunks in the "Transfer-encoding: chunked" format.
941
+ If *chunked * is set, then the *Transfer-encoding * and *content-length *
942
+ headers are disallowed. ``None `` by default (optional).
906
943
907
944
:param bool expect100: Expect 100-continue response from server.
908
945
``False `` by default (optional).
@@ -916,28 +953,60 @@ certification chaining.
916
953
917
954
.. versionadded :: 3.4
918
955
919
- :param aiohttp.BaseConnector connector: BaseConnector sub-class
920
- instance to support connection pooling.
921
-
922
956
:param bool read_until_eof: Read response until EOF if response
923
957
does not have Content-Length header.
924
958
``True `` by default (optional).
925
959
960
+ :param proxy: Proxy URL, :class: `str ` or :class: `~yarl.URL ` (optional)
961
+
962
+ :param aiohttp.BasicAuth proxy_auth: an object that represents proxy HTTP
963
+ Basic Authorization (optional)
964
+
965
+ :param timeout: a :class: `ClientTimeout ` settings structure, 300 seconds (5min)
966
+ total timeout, 30 seconds socket connect timeout by default.
967
+
968
+ :param ssl: SSL validation mode. ``True `` for default SSL check
969
+ (:func: `ssl.create_default_context ` is used),
970
+ ``False `` for skip SSL certificate validation,
971
+ :class: `aiohttp.Fingerprint ` for fingerprint
972
+ validation, :class: `ssl.SSLContext ` for custom SSL
973
+ certificate validation.
974
+
975
+ Supersedes *verify_ssl *, *ssl_context * and
976
+ *fingerprint * parameters.
977
+
978
+ :param str server_hostname: Sets or overrides the host name that the
979
+ target server's certificate will be matched against.
980
+
981
+ See :py:meth: `asyncio.loop.create_connection `
982
+ for more information.
983
+
984
+ :param collections.abc.Mapping proxy_headers: HTTP headers to send to the proxy
985
+ if the parameter proxy has been provided.
986
+
987
+ :param trace_request_ctx: Object used to give as a kw param for each new
988
+ :class: `TraceConfig ` object instantiated,
989
+ used to give information to the
990
+ tracers that is only available at request time.
991
+
926
992
:param int read_bufsize: Size of the read buffer (:attr: `ClientResponse.content `).
927
993
``None `` by default,
928
994
it means that the session global value is used.
929
995
930
996
.. versionadded :: 3.7
931
997
932
- :param timeout: a :class: ` ClientTimeout ` settings structure, 300 seconds (5min)
933
- total timeout, 30 seconds socket connect timeout by default .
998
+ :param bool auto_decompress: Automatically decompress response body.
999
+ May be used to enable/disable auto decompression on a per-request basis .
934
1000
935
- :param loop: :ref: `event loop<asyncio-event-loop> `
936
- used for processing HTTP requests.
937
- If param is ``None ``, :func: `asyncio.get_event_loop `
938
- is used for getting default event loop.
1001
+ :param int max_line_size: Maximum allowed size of lines in responses.
939
1002
940
- .. deprecated :: 2.0
1003
+ :param int max_field_size: Maximum allowed size of header fields in responses.
1004
+
1005
+ :param aiohttp.protocol.HttpVersion version: Request HTTP version,
1006
+ ``HTTP 1.1 `` by default. (optional)
1007
+
1008
+ :param aiohttp.BaseConnector connector: BaseConnector sub-class
1009
+ instance to support connection pooling. (optional)
941
1010
942
1011
:return ClientResponse: a :class: `client response <ClientResponse> ` object.
943
1012
0 commit comments