Spaces:
Sleeping
Sleeping
| import requests | |
| BASE_URL = "https://loren-api-search-articles.hf.space" | |
| 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[:3]}...") # affiche 3 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() | |
| print(tags[0:1]) | |
| test_get_articles_with_tags(tags[0:1]) | |
| if __name__ == "__main__": | |
| main() | |