Loren's picture
Upload 2 files
e8ff22d verified
raw
history blame
1.07 kB
import requests
BASE_URL = "http://localhost:8000" # ⚠️ changer en URL HF Space si déployé
def test_get_tags():
print("🔍 Test: /get_tags")
resp = requests.get(f"{BASE_URL}/get_tags")
if resp.status_code != 200:
print("❌ Erreur", resp.status_code, resp.text)
return
tags = resp.json().get("tags", [])
print(f"✅ {len(tags)} tags récupérés : {tags[:10]}...") # affiche 10 premiers
return tags
def test_get_articles_with_tags(tags):
if not tags:
print("⚠️ Aucun tag trouvé, test sauté")
return
print("\n🔍 Test: /get_articles_with_tags")
params = {"tags": tags}
resp = requests.get(f"{BASE_URL}/get_articles_with_tags", params=params)
if resp.status_code != 200:
print("❌ Erreur", resp.status_code, resp.text)
return
data = resp.json()
print(f"✅ Articles trouvés: {len(data['articles'])}")
def main():
tags = test_get_tags()
test_get_articles_with_tags(tags)
if __name__ == "__main__":
main()