Update value of User-Agent HTTP request header used by listers
That HTTP header value will now contain the lister name but also a link to our contact form in order for sysadmins to easily reach us if needed. The following template is used to generate it: "Software Heritage <lister_name> lister v<swh-lister version> (+https://www.softwareheritage.org/contact)"
This commit is contained in:
parent
db6ce12e9e
commit
d5c30a3ce3
11 changed files with 38 additions and 36 deletions
|
@ -11,7 +11,7 @@ import iso8601
|
|||
import pytest
|
||||
from requests.exceptions import HTTPError
|
||||
|
||||
from swh.lister import USER_AGENT
|
||||
from swh.lister import USER_AGENT_TEMPLATE
|
||||
from swh.lister.npm.lister import NpmLister, NpmListerState
|
||||
|
||||
|
||||
|
@ -53,7 +53,9 @@ def _check_listed_npm_packages(lister, packages, scheduler_origins):
|
|||
|
||||
|
||||
def _match_request(request):
|
||||
return request.headers.get("User-Agent") == USER_AGENT
|
||||
return (
|
||||
request.headers.get("User-Agent") == USER_AGENT_TEMPLATE % NpmLister.LISTER_NAME
|
||||
)
|
||||
|
||||
|
||||
def _url_params(page_size, **kwargs):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue