@click.command(short_help="Geocode an address or coordinates.")
@click.argument('query', default='-', required=False)
@click.option(
    '--forward/--reverse',
    default=True,
    help="Perform a forward or reverse geocode. [default: forward]")
@click.option('--include', '-i', 'include_headers',
              is_flag=True, default=False,
              help="Include HTTP headers in the output.")
@click.option(
    '--lat', type=float, default=None,
    help="Bias results toward this latitude (decimal degrees). --lon "
         "is also required.")
@click.option(
    '--lon', type=float, default=None,
    help="Bias results toward this longitude (decimal degrees). --lat "
         "is also required.")
@click.option(
    '--place-type', '-t', multiple=True, metavar='NAME', default=None,
    type=click.Choice(mapbox.Geocoder().place_types.keys()),
    help="Restrict results to one or more place types.")
@click.option('--output', '-o', default='-', help="Save output to a file.")
@click.option('--dataset', '-d', default='mapbox.places',
              type=click.Choice(("mapbox.places", "mapbox.places-permanent")),
              help="Source dataset for geocoding, [default: mapbox.places]")
@click.option('--country', default=None,
              help="Restrict forward geocoding to specified country codes,"
                   "comma-separated")
@click.pass_context
def geocoding(ctx, query, forward, include_headers, lat, lon,
              place_type, output, dataset, country):
    verbosity = (ctx.obj and ctx.obj.get('verbosity')) or 2
    logger = logging.getLogger('mapbox')

    access_token = (ctx.obj and ctx.obj.get('access_token')) or None
    stdout = click.open_file(output, 'w')

    geocoder = mapbox.Geocoder(name=dataset, access_token=access_token)

    if forward:
        if country:
            country = [x.lower() for x in country.split(",")]

        for q in iter_query(query):
            try:
                resp = geocoder.forward(
                    q, types=place_type, lat=lat, lon=lon, country=country)
            except mapbox.errors.ValidationError as exc:
                raise click.BadParameter(str(exc))

            if include_headers:
                echo_headers(resp.headers, file=stdout)
            if resp.status_code == 200:
                click.echo(resp.text, file=stdout)
            else:
                raise MapboxCLIException(resp.text.strip())
    else:
        for lon, lat in map(coords_from_query, iter_query(query)):
            try:
                resp = geocoder.reverse(lon=lon, lat=lat, types=place_type)
            except mapbox.errors.ValidationError as exc:
                raise click.BadParameter(str(exc))

            if include_headers:
                echo_headers(resp.headers, file=stdout)
            if resp.status_code == 200:
                click.echo(resp.text, file=stdout)
            else:
                raise MapboxCLIException(resp.text.strip())
Resolve the view and apply view middleware in order, returning
dataset/ETHPy150Open mapbox/mapbox-cli-py/mapboxcli/scripts/geocoding.py/geocoding--crossover with--dataset/ETHPy150Open skibblenybbles/django-daydreamer/daydreamer/core/handlers/base.py/Handler.apply_view_middleware