-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_api_response.py
More file actions
66 lines (52 loc) · 2.11 KB
/
debug_api_response.py
File metadata and controls
66 lines (52 loc) · 2.11 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env python3
"""
Debug script to examine the exact API response structure from bridge.list_subscribers
"""
import sys
import os
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from utils.hive_api import HiveAPIClient
import json
def debug_subscribers_api():
"""Debug the subscribers API response structure"""
config = {
'HIVE_ACCOUNT_NAME': 'hiveecuador',
'IMAGE_UPLOAD_SERVICE': 'https://images.hive.blog'
}
client = HiveAPIClient(config)
print("🔍 Testing bridge.list_subscribers API response structure...")
# Test with small limit to see exact structure
result = client._make_api_call_with_failover('bridge.list_subscribers', [{
"community": "hive-115276",
"limit": 5
}])
print(f"\n📋 Raw API Response (first 5 subscribers):")
print(f"Type: {type(result)}")
print(f"Content: {json.dumps(result, indent=2)}")
if result and isinstance(result, list):
print(f"\n🔍 Analyzing structure:")
for i, item in enumerate(result):
print(f" Item {i}: Type={type(item)}, Content={item}")
if isinstance(item, list):
print(f" → Array with {len(item)} elements")
for j, element in enumerate(item):
print(f" [{j}]: {element} (type: {type(element)})")
elif isinstance(item, dict):
print(f" → Dict with keys: {list(item.keys())}")
for key, value in item.items():
print(f" {key}: {value}")
# Test a different approach
print(f"\n🔍 Testing with different parameters...")
result2 = client._make_api_call_with_failover('bridge.list_subscribers', [{
"community": "hive-115276",
"limit": 10,
"last": ""
}])
print(f"\nAlternative API Response:")
print(f"Type: {type(result2)}")
if result2:
print(f"Length: {len(result2)}")
if len(result2) > 0:
print(f"First item: {result2[0]} (type: {type(result2[0])})")
if __name__ == "__main__":
debug_subscribers_api()