GithubHelp home page GithubHelp logo

yqxx / tools Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xiaochao/tools

0.0 1.0 0.0 54 KB

国内所有省、市以及对应的id,以及世界上主要的城市

License: BSD 2-Clause "Simplified" License

Python 54.13% CSS 15.54% HTML 30.33%

tools's Introduction

cities

国内所有省、市以及对应的id,以及世界上主要的城市

##数据来源 ###在此感谢鹅厂,所有的数据都是从鹅厂注册页面获取到的

截图

使用方法:

  • 输入国家名称,获取到国家ID.
  • 输入省,获取到国家和省ID
  • 输入城市,获取到国家、省和市ID

API

url = 'http://tools.bugcode.cn' #####根据城市名字获取城市ID

r = requests.post(url+'/cities/search', {'country': '**', 'language': 'cn', 'province': '江苏', 'city': '淮安'})
if r.status_code == 200:
	print r.text
else:
	print r.status_code

#####根据城市ID获取城市名字

  • 获取所有国家

      r = requests.post(url+'/cities/search', {'action': 'countries', 'language': 'cn'})
      if r.status_code == 200:
      	print r.text
      else:
      	print r.status_code
    
  • 获取一个国家所有省份

      r = requests.post(url+'/cities/search', {'action': 'provinces', 'language': 'cn', 'c_id': 1})
      if r.status_code == 200:
      	print r.text
      else:
      	print r.status_code
    
  • 获取一个国家一个省所有城市

      r = requests.post(url+'/cities/search', {'action': 'cities', 'language': 'cn', 'c_id': 1, 'p_id': 32})
      if r.status_code == 200:
      	print r.text
      else:
      	print r.status_code
    
  • 获取一个国家一个省一个城市

      r = requests.post(url+'/cities/search', {'action': 'city', 'language': 'cn', 'c_id': 1, 'p_id': 32, 'i_id': 8})
      if r.status_code == 200:
      	print r.text
      else:
      	print r.status_code
    

tools's People

Contributors

xiaochao avatar

Watchers

 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.