-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquick_start.py
More file actions
99 lines (82 loc) · 3.07 KB
/
Copy pathquick_start.py
File metadata and controls
99 lines (82 loc) · 3.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/usr/bin/env python3
"""
Quick start script for the News API System
"""
import os
import sys
import requests
import json
def main():
print("=== News API System Quick Start ===\n")
# API base URL
base_url = "https://nlko2jkif0.execute-api.ap-south-1.amazonaws.com/prod"
# Test endpoints
endpoints = [
{
"name": "Latest News",
"url": f"{base_url}/news/latest?limit=3",
"description": "Get the 3 most recent articles"
},
{
"name": "Business News",
"url": f"{base_url}/news/category/business?limit=3",
"description": "Get 3 business articles"
},
{
"name": "Search News",
"url": f"{base_url}/news/search?q=india&limit=3",
"description": "Search for articles about India"
},
{
"name": "Trending News",
"url": f"{base_url}/news/trending?limit=3",
"description": "Get trending articles"
}
]
print("Testing API endpoints...\n")
for endpoint in endpoints:
print(f"🔍 {endpoint['name']}")
print(f" {endpoint['description']}")
print(f" URL: {endpoint['url']}")
try:
response = requests.get(endpoint['url'], timeout=10)
if response.status_code == 200:
data = response.json()
articles = data.get('articles', [])
if articles:
print(f" ✅ Found {len(articles)} articles")
for i, article in enumerate(articles[:2], 1):
title = article.get('title', 'No title')[:50] + '...'
category = article.get('category', 'unknown')
print(f" {i}. [{category}] {title}")
else:
print(f" ⚠️ No articles found")
else:
print(f" ❌ Error: HTTP {response.status_code}")
except Exception as e:
print(f" ❌ Error: {str(e)}")
print()
print("=== System Status ===")
print(f"Base URL: {base_url}")
print("Rate Limit: 100 requests/minute")
print("Cache TTL: 5 minutes")
print("Update Frequency: Every 3 hours")
print()
print("=== Available Categories ===")
categories = ["business", "sports", "technology", "entertainment", "general", "india", "world"]
for category in categories:
print(f" • {category}")
print()
print("=== Deployment Commands ===")
print(" Deploy all: python3 deployment/deploy_all.py")
print(" Monitor: python3 monitoring/monitor_news_api.py")
print(" Check articles: python3 monitoring/check_articles_count.py")
print()
print("=== Documentation ===")
print(" API Docs: docs/NEWS_API_DOCUMENTATION.md")
print(" System: README.md")
print()
print("✅ News API System is ready!")
print(" Visit the documentation for more details.")
if __name__ == "__main__":
main()