| import urllib.request |
| import json |
|
|
| try: |
| url = "http://127.0.0.1:7861/api/datasets" |
| with urllib.request.urlopen(url) as response: |
| data = json.loads(response.read().decode()) |
| print(f"Status Code: {response.getcode()}") |
| print(f"Type: {type(data)}") |
| if isinstance(data, list) and len(data) > 0: |
| print(f"First item: {data[0]}") |
| if "last_updated" in data[0]: |
| print("SUCCESS: last_updated field found.") |
| else: |
| print("FAILURE: last_updated field MISSING.") |
| else: |
| print("Data is empty or not a list.") |
| print(data) |
| except Exception as e: |
| print(f"Error: {e}") |
|
|