Skip to content

Commit 4835c13

Browse files
authored
Fix _is_on_pypi to check response content instead of just catching exceptions (#45933)
PyPIClient.project() returns {'message': 'Not Found'} for non-existent packages without raising an exception. The _is_on_pypi function only checked for exceptions, so it incorrectly treated all packages as already registered on PyPI, preventing name reservation for new packages like azure-mgmt-appnetwork. Fix: check for 'info' key in the response, which is only present for valid PyPI projects.
1 parent 8a5c833 commit 4835c13

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

eng/scripts/discover_unpublished_packages.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
def _is_on_pypi(client, name):
1818
try:
19-
client.project(name)
20-
return True
19+
result = client.project(name)
20+
return "info" in result
2121
except Exception:
2222
return False
2323

0 commit comments

Comments
 (0)