Spaces:
No application file

File size: 533 Bytes
839a850
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import os
import aiohttp

API_KEY = os.getenv("INTELX_API_KEY")
BASE_URL = "https://api.intelx.io"

async def search_intelx(entity: str):
    headers = {
        "x-key": API_KEY,
        "Content-Type": "application/json"
    }
    payload = {
        "term": entity,
        "maxresults": 10,
        "media": 0
    }
    async with aiohttp.ClientSession() as session:
        async with session.post(f"{BASE_URL}/intelligent/search", json=payload, headers=headers) as resp:
            return await resp.json()