Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 7401155

Browse files
committedJun 3, 2025··
fix(pypi): update get_maintainers_of_package to avoid request blocking
Signed-off-by: Amine <amine.raouane@enim.ac.ma>
1 parent 1c65d5f commit 7401155

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed
 

‎src/macaron/slsa_analyzer/package_registry/pypi_registry.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,10 @@ def get_package_page(self, package_name: str) -> str | None:
244244
str | None
245245
The package main page.
246246
"""
247-
url = os.path.join(self.registry_url, "project", package_name)
247+
url = f"https://pypi.org/project/{package_name}/"
248248
response = send_get_http_raw(url)
249249
if response:
250-
html_snippets = response.content.decode("utf-8")
251-
return html_snippets
250+
return response.text
252251
return None
253252

254253
def get_maintainers_of_package(self, package_name: str) -> list | None:
@@ -269,7 +268,7 @@ def get_maintainers_of_package(self, package_name: str) -> list | None:
269268
return None
270269
soup = BeautifulSoup(package_page, "html.parser")
271270
maintainers = soup.find_all("span", class_="sidebar-section__user-gravatar-text")
272-
return list({maintainer.get_text(strip=True) for maintainer in maintainers})
271+
return [maintainer.get_text(strip=True) for maintainer in maintainers]
273272

274273
def get_maintainer_profile_page(self, username: str) -> str | None:
275274
"""Implement custom API to get maintainer's profile page.

0 commit comments

Comments
 (0)