Files
blog/tmp_test.py
T
2026-06-01 17:57:22 +08:00

9 lines
293 B
Python

import urllib.request, urllib.error
try:
r = urllib.request.urlopen('http://localhost:8016/api/posts', timeout=5)
print('STATUS:', r.status)
print(r.read().decode()[:500])
except urllib.error.HTTPError as e:
print('ERROR STATUS:', e.code)
print(e.read().decode()[:500])