MCPcopy
hub / github.com/aio-libs/aiohttp / _request

Method _request

aiohttp/client.py:129–245  ·  view source on GitHub ↗
(self, method, url, *,
                 params=None,
                 data=None,
                 headers=None,
                 skip_auto_headers=None,
                 auth=None,
                 allow_redirects=True,
                 max_redirects=10,
                 encoding='utf-8',
                 version=None,
                 compress=None,
                 chunked=None,
                 expect100=False,
                 read_until_eof=True)

Source from the content-addressed store, hash-verified

127
128 @asyncio.coroutine
129 def _request(self, method, url, *,
130 params=None,
131 data=None,
132 headers=None,
133 skip_auto_headers=None,
134 auth=None,
135 allow_redirects=True,
136 max_redirects=10,
137 encoding='utf-8',
138 version=None,
139 compress=None,
140 chunked=None,
141 expect100=False,
142 read_until_eof=True):
143
144 if version is not None:
145 warnings.warn("HTTP version should be specified "
146 "by ClientSession constructor", DeprecationWarning)
147 else:
148 version = self._version
149
150 if self.closed:
151 raise RuntimeError('Session is closed')
152
153 redirects = 0
154 history = []
155 if not isinstance(method, upstr):
156 method = upstr(method)
157
158 # Merge with default headers and transform to CIMultiDict
159 headers = self._prepare_headers(headers)
160 if auth is None:
161 auth = self._default_auth
162 # It would be confusing if we support explicit Authorization header
163 # with `auth` argument
164 if (headers is not None and
165 auth is not None and
166 hdrs.AUTHORIZATION in headers):
167 raise ValueError("Can't combine `Authorization` header with "
168 "`auth` argument")
169
170 skip_headers = set(self._skip_auto_headers)
171 if skip_auto_headers is not None:
172 for i in skip_auto_headers:
173 skip_headers.add(upstr(i))
174
175 while True:
176 req = self._request_class(
177 method, url, params=params, headers=headers,
178 skip_auto_headers=skip_headers, data=data,
179 cookies=self.cookies, encoding=encoding,
180 auth=auth, version=version, compress=compress, chunked=chunked,
181 expect100=expect100,
182 loop=self._loop, response_class=self._response_class)
183
184 conn = yield from self._connector.connect(req)
185 try:
186 resp = req.send(conn.writer, conn.reader)

Callers 9

requestMethod · 0.95
getMethod · 0.95
optionsMethod · 0.95
headMethod · 0.95
postMethod · 0.95
putMethod · 0.95
patchMethod · 0.95
deleteMethod · 0.95
requestFunction · 0.95

Calls 10

_prepare_headersMethod · 0.95
_update_cookiesMethod · 0.95
appendMethod · 0.80
connectMethod · 0.45
sendMethod · 0.45
startMethod · 0.45
closeMethod · 0.45
update_cookiesMethod · 0.45
releaseMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected