ORION-Runtime / space /_debug_http.py
Alvoradozerouno's picture
ORION System Update 2026-05-12: Multi-Agent Discussion, KRIA Validation, Agent Refactor, DDGK->ORION Migration
da3e674
Raw
History Blame Contribute Delete
1.46 kB
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Debug _http_get"""
import sys, os
project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if project_root not in sys.path:
sys.path.insert(0, project_root)
import asyncio
import requests
import aiohttp
from space.eu_gaia_x_adapter import EUGaiaXAdapter
async def main():
a = EUGaiaXAdapter()
print(f"aiohttp available: {aiohttp is not None}")
print(f"self._http: {a._http}")
print(f"hasattr(a._http, 'get'): {hasattr(a._http, 'get') if a._http else 'N/A'}")
url = 'https://api.openaire.eu/search/publications'
params = {'format': 'json', 'size': 2, 'query': 'climate'}
# Test with explicit requests (bypass _http_get)
print("\n--- Direct requests.get ---")
resp = requests.get(url, params=params, timeout=15)
print(f"status: {resp.status_code}")
data = resp.json()
print(f"type: {type(data)}, keys: {list(data.keys())}")
# Test _http_get
print("\n--- _http_get ---")
try:
data2 = await a._http_get(url, params=params, timeout=15)
print(f"type: {type(data2)}")
if data2 is None:
print("RESULT IS NONE!")
elif isinstance(data2, dict):
print(f"keys: {list(data2.keys())}")
else:
print(f"value: {data2}")
except Exception as e:
print(f"EXCEPTION: {type(e).__name__}: {e}")
await a.close()
asyncio.run(main())