File tree Expand file tree Collapse file tree 2 files changed +60
-0
lines changed Expand file tree Collapse file tree 2 files changed +60
-0
lines changed Original file line number Diff line number Diff line change
1
+ # <b >Desktop Notifier</b >
2
+
3
+ [ ![ forthebadge] ( https://forthebadge.com/images/badges/made-with-python.svg )] ( https://forthebadge.com )
4
+
5
+ ## Desktop Notifier Functionalities : 🚀
6
+
7
+ - On running the script it gives a notification of top 10 news
8
+
9
+ ## Desktop Notifier Instructions: 👨🏻💻
10
+
11
+ ### Step 1:
12
+
13
+ Open Termnial 💻
14
+
15
+ ### Step 2:
16
+
17
+ Locate to the directory where python file is located 📂
18
+
19
+ ### Step 3:
20
+
21
+ Run the command: python script.py/python3 script.py 🧐
22
+
23
+ ### Step 4:
24
+
25
+ Sit back and Relax. Let the Script do the Job. ☕
26
+
27
+ ### Requirements
28
+
29
+ - plyer
30
+ - requests
31
+ - json
32
+
33
+ ## Author
34
+
35
+ Amit Kumar Mishra
36
+
Original file line number Diff line number Diff line change
1
+
2
+ from plyer import notification
3
+ import requests
4
+ import json
5
+
6
+ country_code = input ("Enter the country code for the news: " )
7
+ api_key = input ("Enter the api key: " )
8
+
9
+ news = requests .get (f'https://newsapi.org/v2/top-headlines?country={ country_code } &apiKey={ api_key } ' )
10
+
11
+ data = json .loads (news .content )
12
+
13
+ for i in range (10 ):
14
+
15
+ notification .notify (
16
+ title = data ['articles' ][i ]['title' ][:20 ],
17
+ message = data ['articles' ][i ]['description' ][:44 ] ,
18
+ # displaying time
19
+ timeout = 5 ,
20
+ toast = False )
21
+
22
+
23
+
24
+
You can’t perform that action at this time.
0 commit comments