9 lines
293 B
Python
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])
|