Add spec link to scrapy/spidermiddlewares/referer.py

Co-authored-by: Adrián Chaves <adrian@chaves.io>
This commit is contained in:
Fabian Schneebauer 2024-05-29 13:19:27 +02:00 committed by GitHub
parent 0d58af8697
commit 62a028b99d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 0 deletions

View File

@ -324,6 +324,7 @@ def _load_policy_class(
return cast(Type[ReferrerPolicy], load_object(policy))
except ValueError:
tokens = [token.strip() for token in policy.lower().split(",")]
# https://www.w3.org/TR/referrer-policy/#parse-referrer-policy-from-header
for token in tokens[::-1]:
if token in _policy_classes:
return _policy_classes[token]