We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 2fe739f + 54a60d0 commit fd4fd37Copy full SHA for fd4fd37
publish.py
@@ -31,11 +31,15 @@
31
32
33
def already_published(name, version):
34
+ url = f'https://static.crates.io/crates/{name}/{version}/download'
35
try:
- urllib.request.urlopen('https://crates.io/api/v1/crates/%s/%s/download' % (name, version))
36
+ urllib.request.urlopen(url)
37
except HTTPError as e:
- if e.code == 404:
38
+ # 403 and 404 are common responses to assume it is not published
39
+ if 400 <= e.code < 500:
40
return False
41
+ print(f'error: failed to check if {name} {version} is already published')
42
+ print(f' HTTP response error code {e.code} checking {url}')
43
raise
44
return True
45
0 commit comments