chore: port lab5 solution as lab6 base

This commit is contained in:
2026-11-18 18:40:47 +03:00
parent 470d9d6f1e
commit 98d5787545
105 changed files with 21898 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
#!/usr/bin/env python3
import sys
import urllib.error
import urllib.request
bucket, key = sys.argv[1:3]
base = 'http://s3:9000/' + bucket
attempts = (
('GET', '/<object>', base + '/' + key, None),
('GET', '/', base + '/', None),
('PUT', '/anon.txt', base + '/anon.txt', b'x'),
)
failed = False
for method, label, url, data in attempts:
try:
code = urllib.request.urlopen(urllib.request.Request(url, data=data, method=method), timeout=5).status
except urllib.error.HTTPError as error:
code = error.code
print(method, bucket + label, '->', code)
failed = failed or code != 403
sys.exit(1 if failed else 0)