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