Mercurial > hg > GlobalNeighbors
view globalneighbors/main.py @ 19:811adc9736eb
add configuration for gunicorn
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Sun, 25 Jun 2017 15:43:45 -0700 |
parents | 5dba84370182 |
children |
line wrap: on
line source
#!/usr/bin/env python # -*- coding: utf-8 -*- """ locate nearest cities """ # imports import argparse import json import os import sys import time from .cli import CitiesParser from .locations import locations from .read import read_cities from .schema import fields try: # python 2 string = (str, unicode) except NameError: # python 3 string = (str, ) def main(args=sys.argv[1:]): """CLI""" # parse command line options parser = CitiesParser(description=__doc__) options = parser.parse_args(args) # read data cities = list(read_cities(options.cities, fields=fields)) # get locations city_locations = locations(cities) # output print (json.dumps(city_locations, indent=2, sort_keys=True)) if __name__ == '__main__': main()