Spaces:
Paused
Paused
Delete routers/instagram.py
Browse files- routers/instagram.py +0 -45
routers/instagram.py
DELETED
|
@@ -1,45 +0,0 @@
|
|
| 1 |
-
import httpx
|
| 2 |
-
from fastapi import APIRouter, HTTPException
|
| 3 |
-
|
| 4 |
-
router = APIRouter()
|
| 5 |
-
|
| 6 |
-
@router.get("/get")
|
| 7 |
-
async def test_instagram_api():
|
| 8 |
-
"""
|
| 9 |
-
Executa exatamente o mesmo cURL que funcionou no playground
|
| 10 |
-
"""
|
| 11 |
-
|
| 12 |
-
# URL exata do cURL que funcionou
|
| 13 |
-
url = "https://graph.instagram.com/17841464166934843/media"
|
| 14 |
-
|
| 15 |
-
# Parâmetros exatos do cURL
|
| 16 |
-
params = {
|
| 17 |
-
"domain": "INSTAGRAM",
|
| 18 |
-
"image_url": "https://static01.nyt.com/images/2025/08/06/multimedia/06xp-mack-vkjp/06xp-mack-vkjp-mobileMasterAt3x.jpg",
|
| 19 |
-
"access_token": "IGAAPf2LpaWcxBZAE1xTUdBeGFFTWFZAVTFMOHdBc21pTlJULXVaWVBXZAUNfZAUFKS1hMeENUV1FFRmpURjUxdnhZAeDN1cmVJLVFJeTZAuclFKVVRWNmltTHV1TE9pdXVWTVpzbFNqbGxVb1U1X3d0a3ozNDJWeFhvbHlZAckR0OXRlawZDZD"
|
| 20 |
-
}
|
| 21 |
-
|
| 22 |
-
try:
|
| 23 |
-
async with httpx.AsyncClient(timeout=30.0) as client:
|
| 24 |
-
print(f"🚀 Fazendo POST para: {url}")
|
| 25 |
-
print(f"📋 Parâmetros: {params}")
|
| 26 |
-
|
| 27 |
-
# Faz a requisição POST exatamente como o cURL
|
| 28 |
-
response = await client.post(url, params=params)
|
| 29 |
-
|
| 30 |
-
print(f"📊 Status Code: {response.status_code}")
|
| 31 |
-
print(f"📄 Response: {response.text}")
|
| 32 |
-
|
| 33 |
-
# Retorna a resposta completa
|
| 34 |
-
return {
|
| 35 |
-
"status_code": response.status_code,
|
| 36 |
-
"response_text": response.text,
|
| 37 |
-
"success": response.status_code == 200
|
| 38 |
-
}
|
| 39 |
-
|
| 40 |
-
except Exception as e:
|
| 41 |
-
print(f"❌ Erro: {str(e)}")
|
| 42 |
-
raise HTTPException(
|
| 43 |
-
status_code=500,
|
| 44 |
-
detail=f"Erro: {str(e)}"
|
| 45 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|