Neuralsingh123 commited on
Commit
4b5d1a1
·
verified ·
1 Parent(s): 29ef7e4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -5
app.py CHANGED
@@ -17,13 +17,23 @@ def get_news_headlines() -> str:
17
  formatted string. If no articles are available, it returns a message indicating that
18
  no news is available. In case of a request error, it returns an error message.
19
  Returns:
20
- str: A string containing the top 5 news headlines and their sources, or an error message.
 
21
  """
22
- api_key= "2f90b8ee0ea64f08b2e9a4c9a13a69c4"
23
-
24
- sources = "google-news" # Replace with source ID or name
25
- language = "es"
26
 
 
 
 
 
 
 
 
 
 
27
  url = f"https://newsapi.org/v2/everything?q=&sources={sources}&language={language}&apiKey={api_key}"
28
 
29
  try:
 
17
  formatted string. If no articles are available, it returns a message indicating that
18
  no news is available. In case of a request error, it returns an error message.
19
  Returns:
20
+ str: A
21
+ containing the top 5 news headlines and their sources, or an error message.
22
  """
23
+ api_key = "2f90b8ee0ea64f08b2e9a4c9a13a69c4"
24
+
25
+ sources = "google-news-in" # Replace with the actual source ID
26
+ language = "en" # Define language before using it
27
 
28
+ # Dictionary to store source details
29
+ source_info = {
30
+ "name": "Google News (India)",
31
+ "description": "Comprehensive, up-to-date India news coverage, aggregated from sources all over the world by Google News.",
32
+ "url": "https://news.google.com",
33
+ "category": "general",
34
+ "language": language,
35
+ "country": "in"
36
+ }
37
  url = f"https://newsapi.org/v2/everything?q=&sources={sources}&language={language}&apiKey={api_key}"
38
 
39
  try: