-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_clusters.py
More file actions
42 lines (34 loc) · 1.33 KB
/
debug_clusters.py
File metadata and controls
42 lines (34 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env python3
import requests
import json
import os
from dotenv import load_dotenv
load_dotenv()
api_key = os.getenv('COURTLISTENER_API_KEY')
def debug_clusters_response():
headers = {'Authorization': f'Token {api_key}'}
# Test 1: Try clusters endpoint with specific citation
print("=== Testing Clusters Endpoint for 410 US 113 ===")
url = 'https://www.courtlistener.com/api/rest/v4/clusters/'
params = {
'citation__volume': '410',
'citation__reporter': 'U.S.',
'citation__page': '113',
'format': 'json'
}
response = requests.get(url, params=params, headers=headers)
print(f'Status: {response.status_code}')
print(f'URL: {response.url}')
if response.status_code == 200:
data = response.json()
print(f'Raw response type: {type(data)}')
print(f'Raw response keys: {data.keys() if isinstance(data, dict) else "Not a dict"}')
print(f'Response (first 500 chars): {str(data)[:500]}...')
# Print full JSON structure
print("\n=== FULL JSON RESPONSE ===")
print(json.dumps(data, indent=2)[:2000] + "..." if len(str(data)) > 2000 else json.dumps(data, indent=2))
else:
print(f"Error: {response.status_code}")
print(response.text)
if __name__ == "__main__":
debug_clusters_response()