Update app.py
Browse files
app.py
CHANGED
|
@@ -3,6 +3,9 @@ import requests
|
|
| 3 |
from bs4 import BeautifulSoup
|
| 4 |
import random
|
| 5 |
from datetime import datetime
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
signs = [
|
| 8 |
'aries', 'taurus', 'gemini', 'cancer', 'leo', 'virgo',
|
|
@@ -11,7 +14,7 @@ signs = [
|
|
| 11 |
|
| 12 |
def get_trending_news():
|
| 13 |
"""Fetch and return trending news headlines."""
|
| 14 |
-
url = "http://newsapi.org/v2/top-headlines?country=us&apiKey="
|
| 15 |
try:
|
| 16 |
page = requests.get(url).json()
|
| 17 |
articles = page["articles"]
|
|
|
|
| 3 |
from bs4 import BeautifulSoup
|
| 4 |
import random
|
| 5 |
from datetime import datetime
|
| 6 |
+
import os
|
| 7 |
+
|
| 8 |
+
HF_API_KEY = os.getenv("NewsAppToken")
|
| 9 |
|
| 10 |
signs = [
|
| 11 |
'aries', 'taurus', 'gemini', 'cancer', 'leo', 'virgo',
|
|
|
|
| 14 |
|
| 15 |
def get_trending_news():
|
| 16 |
"""Fetch and return trending news headlines."""
|
| 17 |
+
url = f"http://newsapi.org/v2/top-headlines?country=us&apiKey={HF_API_KEY}"
|
| 18 |
try:
|
| 19 |
page = requests.get(url).json()
|
| 20 |
articles = page["articles"]
|