Skip to content

Commit ed5e6e2

Browse files
committed
working
1 parent 26b445b commit ed5e6e2

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

tools/all_repos.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ async def get_package_maintainers(package: str) -> list[str]:
125125
if response.status_code == 200:
126126
html = response.text
127127
soup = BeautifulSoup(html, "html.parser")
128-
maintainers = soup.find_all("a", class_="package-header__author-link")
128+
maintainers = soup.find_all("span", class_="sidebar-section__maintainer")
129129
if not maintainers:
130130
return ["unknown (blocked by fastly?)"]
131131
return [a.text.strip() for a in maintainers]
@@ -156,20 +156,23 @@ async def main():
156156

157157
async with trio.open_nursery() as nursery:
158158
targets = []
159-
for org, repo in todo:
159+
semaphore = trio.Semaphore(10) # Throttle to 10 concurrent requests
160+
for org, repo in todo[:10]:
160161

161162
async def _loc(targets, org, repo):
162-
maintainers = await get_package_maintainers(repo)
163-
targets.append(
164-
(
165-
org,
166-
repo,
163+
async with semaphore: # Wait for semaphore to be available
164+
maintainers = await get_package_maintainers(repo)
165+
targets.append(
167166
(
168-
await asks.get(f"https://pypi.org/pypi/{repo}/json")
169-
).status_code,
170-
maintainers,
167+
org,
168+
repo,
169+
(
170+
await asks.get(f"https://pypi.org/pypi/{repo}/json")
171+
).status_code,
172+
maintainers,
173+
)
171174
)
172-
)
175+
print(".", end="", flush=True)
173176

174177
nursery.start_soon(_loc, targets, org, repo)
175178

0 commit comments

Comments
 (0)