Concise, Handy and Elegant Notes for Developers



Air Quality Index

I’v been experimenting to fetch data related to AQI in China recently.

A good resource is, which provides air pollution data in a good way by city, and I try to write a python script to crawl the data from it.

Another website is, it reports AQI from US consulate in Chinese major cities, i.e. Beijing, Shanghai, Guangzhou, Chengdu and Shenyang. Similarly, the code to fetch data from it shown below.

Both of the code above are using Python and handy packages like requests and Beautiful Soup.

The stateair website also provides historical data for download in CSV format, therefore I use those data to create a simple visulization page. Check it from and source code is availabe from Github repo.

Last but not least, I found website, and they provide real time data for all Chinese cities, even better, they have opened their API for develper and I also created a Python library based on their API. Code available from