File size: 693 Bytes
b5567db
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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}")