Giter VIP home page Giter VIP logo

geocoder-api's Introduction

Swagger generated server

Overview

This server was generated by the swagger-codegen project. By using the OpenAPI-Spec from a remote server, you can easily generate a server stub. This is an example of building a swagger-enabled Flask server.

This example uses the Connexion library on top of Flask.

Requirements

Python 3.5.2+ Ensure the port you want to run on is defined in your environment as a variable named GEOCODER_PORT. Ensure the host url you want to run on is defined in your environment as a variable named GEOCODER_HOST. Ensure the your Google API key is defined in your environment as a variable named GOOGLE_API_KEY.

Usage

To run the server, please execute the following from the root directory:

pip3 install -r requirements.txt
python3 -m swagger_server

and open your browser to here:

http://localhost:8080/geocoder/ui/

Your Swagger definition lives here:

http://localhost:8080/geocoder/swagger.json

To launch the integration tests, run pytest:

pytest

Running with Docker

To run the server on a Docker container, please execute the following from the root directory:

# building the image
docker build --build-arg GEOCODER_PORT=$GEOCODER_PORT --build-arg GEOCODER_HOST=$GEOCODER_HOST --build-arg GOOGLE_API_KEY=$GOOGLE_API_KEY -t geocoder_server ./

# starting up a container
docker run -p $GEOCODER_PORT:$GEOCODER_PORT geocoder_server

Example Request/Response

To generate more example curl commands, go to http://localhost:8080/geocoder/ui/ and click through the interface.

request

curl -X GET --header 'Accept: application/json' 'http://localhost:8080/geocoder/forwd?location=San%20Francisco'

response:

{
  "accuracy": "APPROXIMATE",
  "address": "San Francisco, CA, USA",
  "bbox": {
    "northeast": [
      37.812,
      -122.3482
    ],
    "southwest": [
      37.70339999999999,
      -122.527
    ]
  },
  "city": "SF",
  "confidence": 3,
  "country": "US",
  "county": "San Francisco County",
  "lat": 37.7749295,
  "lng": -122.4194155,
  "ok": true,
  "place": "ChIJIQBpAG2ahYAR_6128GcTUEo",
  "quality": "locality",
  "state": "CA",
  "status": "OK"
}

Note

This API makes use of the Google Geocoding API. For error responses not documented in the Swagger documentation, see the linked Google documentation.

geocoder-api's People

Contributors

ibeckermayer avatar josiah-roberts 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.