Use response.headers instead of response.getheaders()

response.getheaders() will be deprecated by urllib3.
This commit is contained in:
Astound 2024-03-11 09:47:35 +08:00
parent cda4fd1f26
commit b91d53dc6f
Signed by: kaiser
GPG Key ID: 97504AF0027B1A56
2 changed files with 2 additions and 2 deletions

View File

@ -84,7 +84,7 @@ def proxy_site(env, start_response, video=False):
else: else:
response, cleanup_func = util.fetch_url_response(url, send_headers) response, cleanup_func = util.fetch_url_response(url, send_headers)
response_headers = response.getheaders() response_headers = response.headers
if isinstance(response_headers, urllib3._collections.HTTPHeaderDict): if isinstance(response_headers, urllib3._collections.HTTPHeaderDict):
response_headers = response_headers.items() response_headers = response_headers.items()
if video: if video:

View File

@ -336,7 +336,7 @@ def fetch_url(url, headers=(), timeout=15, report_text=None, data=None,
) )
) )
): ):
print(response.status, response.reason, response.getheaders()) print(response.status, response.reason, response.headers)
ip = re.search( ip = re.search(
br'IP address: ((?:[\da-f]*:)+[\da-f]+|(?:\d+\.)+\d+)', br'IP address: ((?:[\da-f]*:)+[\da-f]+|(?:\d+\.)+\d+)',
content) content)