Git Product home page Git Product logo

cnregion's Introduction

CN Region

这个脚本从**统计局官方网站 下载数据并保存到sqlite3数据库。

安装

$ pip install cnregion

HTTP API

该项目提供一个公开的API,可以无需搭建自己的服务器。

format参数可以选择[json,jsonp],如果选择jsonp,/jsonp/provinces/?callback=call_provinces有效。

GET /{format}/provinces/

HTTP/1.1 200

[
    {
        "id": 11,
        "name": "北京"
]

使用

$ cnregion 

usage: region_fetch.py [-h] [--skip-province SKIP_PROVINCE] [--verbose]
                       sqlite3

从国家统计局网站下载最新的行政区

positional arguments:
  sqlite3               SQLite文件位置

optional arguments:
  -h, --help            show this help message and exit
  --skip-province SKIP_PROVINCE
                        跳过省份的第x个
  --verbose, -v         打印日志内容

Dockerfile 开发环境

$ docker build .
Removing intermediate container bc39e330f294
Successfully built 2202867a5e91
$ docker run -t -i --rm -v /Users/goku/workspace/cnregion:/cnregion \
> 2202867a5e91 /bin/bash
root@5bb9c06986d7:/# python /cnregion/cli.py

cnregion's People

Contributors

gokush 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.