File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -340,6 +340,18 @@ python youtube-bot-linux.py
340340# For Windows Users
341341python youtube-bot-windows.py
342342```
343+
344+ * ### Air Quality Script
345+ - This script renders the air quality from the location of the user
346+ - The location is fetched using the user's IP address
347+
348+ - This script requires a key from WAQI.
349+ - It is free and can be fetched from http://aqicn.org/data-platform/token/#/
350+ #### Usage Instructions
351+ ``` python
352+ python air- quality.py token
353+ ```
354+
343355# ### NOTE :
344356In case your browser stoped working delete/ comment the following line in the script.
345357# ### _Linux_
@@ -396,6 +408,7 @@ The following people helped in creating the above content.
396408* < a href= " https://github.com/iyanuashiri" target= " _blank" > Iyanu Ashiri< / a>
397409* < a href= " https://github.com/niharikakrishnan" > Niharika Krishnan< / a>
398410* < a href= " https://github.com/lionasp" target= " _blank" > Pugach Vitalii< / a>
411+ * < a href= " https://github.com/ayrusme" target= " _blank" > Surya Raman< / a>
399412
400413# ## If you like the project give a star [<img src="Selection_008.png" alt="Star button" align="top">](https://github.com/Logan1x/Python-Scripts/stargazers)
401414
Original file line number Diff line number Diff line change 1+ """Script to get the air quality based on the user's current location"""
2+
3+ import sys
4+
5+ import requests as req
6+
7+ if __name__ == "__main__" :
8+ if len (sys .argv ) > 1 :
9+ url = "https://api.waqi.info/feed/here/?token=" + sys .argv [1 ]
10+ response = req .get (url , verify = False )
11+ if response .json ()['status' ] == "ok" :
12+ print ("The air quality is " + str (response .json ()['data' ]['aqi' ]))
13+ print ("The data was fetched from " + response .json ()['data' ]['city' ]['name' ])
14+ print ("The pollutant measured was " + str (response .json ()['data' ]['dominentpol' ]))
15+ elif response .json ()['status' ] == "error" :
16+ print ("The server returned an error. The message is " + response .json ()['data' ])
17+ else :
18+ print ("Cannot fetch AQI without token" )
You can’t perform that action at this time.
0 commit comments