41 lines
No EOL
1.1 KiB
Python
41 lines
No EOL
1.1 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Simple test of Unipile API to understand the correct endpoint.
|
|
"""
|
|
import os
|
|
import httpx
|
|
import json
|
|
from dotenv import load_dotenv
|
|
|
|
load_dotenv()
|
|
|
|
api_key = os.getenv('UNIPILE_API_KEY')
|
|
print(f"Testing with API key: {api_key[:20]}...")
|
|
|
|
# Try the exact endpoint from Unipile documentation
|
|
url = "https://api1.unipile.com:13111/api/v1/linkedin/profile/giovannafossati"
|
|
|
|
headers = {
|
|
"X-API-KEY": api_key,
|
|
"accept": "application/json"
|
|
}
|
|
|
|
print(f"\nTesting endpoint: {url}")
|
|
print(f"Headers: {json.dumps(headers, indent=2)}")
|
|
|
|
try:
|
|
with httpx.Client(timeout=30.0) as client:
|
|
response = client.get(url, headers=headers)
|
|
print(f"\nStatus Code: {response.status_code}")
|
|
print(f"Response Headers: {dict(response.headers)}")
|
|
|
|
if response.status_code == 200:
|
|
data = response.json()
|
|
print(f"\nSuccess! Profile data:")
|
|
print(json.dumps(data, indent=2))
|
|
else:
|
|
print(f"\nError Response:")
|
|
print(response.text)
|
|
|
|
except Exception as e:
|
|
print(f"\nException: {e}") |