"""
Give Eden web search capabilities
"""
import requests
import json

def web_search_for_eden(query):
    """
    Eden can search the web for information
    Uses DuckDuckGo API (no key needed)
    """
    try:
        url = f"https://api.duckduckgo.com/?q={query}&format=json"
        response = requests.get(url, timeout=10)
        return response.json()
    except Exception as e:
        return {"error": str(e)}

def search_github_code(query, language="python"):
    """
    Search GitHub for code examples
    """
    url = f"https://api.github.com/search/code?q={query}+language:{language}"
    try:
        response = requests.get(url, timeout=10)
        return response.json()
    except Exception as e:
        return {"error": str(e)}

# Test
if __name__ == '__main__':
    result = web_search_for_eden("python scipy integration")
    print(json.dumps(result, indent=2))
