Giter Club home page Giter Club logo

aqicn's Introduction

aqicn

#####Scraper for aqicn.org

####Install

#####OS X:

  1. Install from Python 3.4
  2. Install the required libraries using pip (see below for libraries)
  3. Download aqicn.py
  4. Setup the output directory inside the script
  5. run the script aqicn.py (you may need to chmod +x)

#####Cent OS:

  • You must download and compile Python 3.4

Follow this guide http://toomuchdata.com/2014/02/16/how-to-install-python-on-centos/

wget https://www.python.org/ftp/python/3.4.1/Python-3.4.1.tgz --no-check-certificate
tar -xzvf Python-3.4.1.tgz
cd Python-3.4.1
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
./configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
make && sudo make altinstall
#PyPi will be installed at /usr/local/bin/pip3.4
sudo /usr/local/bin/pip3.4 install requests
sudo /usr/local/bin/pip3.4 install beautifulsoup4
sudo /usr/local/bin/pip3.4 install python-dateutil
  • Download aqicn.py
  • Setup the output directory inside the script
  • run the script aqicn.py (you may need to chmod +x)
  • change the script to look use the python /usr/local/bin/python3.4 instaed of /usr/bin/python

####Output

#####Console It should look like this

Getting the main page
Finding the json
There are 3181 cities
Scraping Weifang () 1 of 3181 ['36.706774', '119.161756'] 1510
Saved cur_pm25,cur_pm10,cur_o3,cur_no2,cur_so2,cur_co,aqi for city Weifang ()

Errors will be printed as they occur. Sometimes unicode handling in Python has some issues. #####Files Files will be saved to

[directory]/Data/AQICN/Variable/YYYY/MM/yyyymmdd-variable.csv

You can change the base [directory] by editing the script. It is defaulted to "./"

####Troubleshooting

If you UnicodeException you made need to set the enviroment variable PYTHONIOENCODING to utf-8

###Written in Python 3.4

####Libraries Uses PyPi Versions of

Just run the command after the colon to install them with pip. pip is installed with Python 3.4

###Developed in Eclipse ####Eclipse Plugins

aqicn's People

Contributors

bryanroscoe avatar untrust avatar

Watchers

James Cloos avatar Yufang Hao avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.