@@ -119,7 +119,9 @@ def get_cargo_versions_from_purl(purl):
119119 """Fetch versions of Rust cargo packages from the crates.io API."""
120120 purl = PackageURL .from_string (purl )
121121 url = f"https://crates.io/api/v1/crates/{ purl .name } "
122- response = get_response (url = url , content_type = "json" )
122+ response = get_response (
123+ url = url , content_type = "json" , headers = {"User-Agent" : "pm_bot" }
124+ )
123125
124126 for version_info in response .get ("versions" ):
125127 yield PackageVersion (
@@ -260,7 +262,7 @@ def get_conan_versions_from_purl(purl):
260262
261263
262264@router .route ("pkg:github/.*" )
263- def get_conan_versions_from_purl (purl ):
265+ def get_github_versions_from_purl (purl ):
264266 """Fetch versions of ``github`` packages using GitHub REST API."""
265267 purl = PackageURL .from_string (purl )
266268 response = get_response (
@@ -324,7 +326,7 @@ def trim_go_url_path(url_path: str) -> Optional[str]:
324326 and returns the remaining the module name.
325327 For example:
326328 >>> module = "github.com/xx/a"
327- >>> assert GoproxyVersionAPI. trim_go_url_path("https://github.com/xx/a/b") == module
329+ >>> assert trim_go_url_path("https://github.com/xx/a/b") == module
328330 """
329331 # some advisories contains this prefix in package name, e.g. https://github.com/advisories/GHSA-7h6j-2268-fhcm
330332 if url_path .startswith ("https://pkg.go.dev/" ):
0 commit comments