mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-05-18 19:41:06 +00:00
Remove HttpUrl.getheader()
This commit is contained in:
parent
1018b8332b
commit
53bd5c4d21
1 changed files with 3 additions and 13 deletions
|
|
@ -110,7 +110,7 @@ class HttpUrl(internpaturl.InternPatternUrl, proxysupport.ProxySupport):
|
|||
# Note that content-encoding causes size differences since
|
||||
# the content data is always decoded.
|
||||
try:
|
||||
self.size = int(self.getheader("Content-Length"))
|
||||
self.size = int(self.headers["Content-Length"])
|
||||
except (ValueError, OverflowError):
|
||||
pass
|
||||
else:
|
||||
|
|
@ -284,17 +284,6 @@ class HttpUrl(internpaturl.InternPatternUrl, proxysupport.ProxySupport):
|
|||
# run connection plugins for old connection
|
||||
self.aggregate.plugin_manager.run_connection_plugins(self)
|
||||
|
||||
def getheader(self, name, default=None):
|
||||
"""Get header value.
|
||||
|
||||
@return: header value or default of not found
|
||||
@rtype: str
|
||||
"""
|
||||
value = self.headers.get(name)
|
||||
if value is None:
|
||||
return default
|
||||
return value
|
||||
|
||||
def check_response(self):
|
||||
"""Check final result and log it."""
|
||||
if (
|
||||
|
|
@ -314,7 +303,8 @@ class HttpUrl(internpaturl.InternPatternUrl, proxysupport.ProxySupport):
|
|||
|
||||
if self.url_connection.status_code == 429:
|
||||
self.add_warning(
|
||||
"Rate limited (Retry-After: %s)" % self.getheader(_("Retry-After")),
|
||||
"Rate limited (Retry-After: %s)"
|
||||
% self.headers.get(_("Retry-After")),
|
||||
tag=WARN_URL_RATE_LIMITED,
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue