Method
open
(
self,
path: str,
*,
method: str = "GET",
headers: dict | Headers | None = None,
data: AnyStr | None = None,
form: dict | None = None,
files: dict[str, FileStorage] | None = None,
query_string: dict | None = None,
json: Any = sentinel,
scheme: str = "http",
follow_redirects: bool = False,
root_path: str = "",
http_version: str = "1.1",
scope_base: dict | None = None,
auth: Authorization | tuple[str, str] | None = None,
subdomain: str | None = None,
)
Source from the content-addressed store, hash-verified
| 71 | self.push_promises: list[tuple[str, Headers]] = [] |
| 72 | |
| 73 | async def open( |
| 74 | self, |
| 75 | path: str, |
| 76 | *, |
| 77 | method: str = "GET", |
| 78 | headers: dict | Headers | None = None, |
| 79 | data: AnyStr | None = None, |
| 80 | form: dict | None = None, |
| 81 | files: dict[str, FileStorage] | None = None, |
| 82 | query_string: dict | None = None, |
| 83 | json: Any = sentinel, |
| 84 | scheme: str = "http", |
| 85 | follow_redirects: bool = False, |
| 86 | root_path: str = "", |
| 87 | http_version: str = "1.1", |
| 88 | scope_base: dict | None = None, |
| 89 | auth: Authorization | tuple[str, str] | None = None, |
| 90 | subdomain: str | None = None, |
| 91 | ) -> Response: |
| 92 | self.push_promises = [] |
| 93 | response = await self._make_request( |
| 94 | path, |
| 95 | method, |
| 96 | headers, |
| 97 | data, |
| 98 | form, |
| 99 | files, |
| 100 | query_string, |
| 101 | json, |
| 102 | scheme, |
| 103 | root_path, |
| 104 | http_version, |
| 105 | scope_base, |
| 106 | auth, |
| 107 | subdomain, |
| 108 | ) |
| 109 | if follow_redirects: |
| 110 | while response.status_code >= 300 and response.status_code <= 399: |
| 111 | # Most browsers respond to an HTTP 302 with a GET request to the |
| 112 | # new location, despite what the HTTP spec says. HTTP 303 should |
| 113 | # always be responded to with a GET request. |
| 114 | if response.status_code == 302 or response.status_code == 303: |
| 115 | method = "GET" |
| 116 | response = await self._make_request( |
| 117 | response.location, |
| 118 | method, |
| 119 | headers, |
| 120 | data, |
| 121 | form, |
| 122 | files, |
| 123 | query_string, |
| 124 | json, |
| 125 | scheme, |
| 126 | root_path, |
| 127 | http_version, |
| 128 | scope_base, |
| 129 | auth, |
| 130 | subdomain, |
Tested by
no test coverage detected