Created
November 13, 2016 15:19
-
-
Save DEKHTIARJonathan/0e7d718ea5fed1e944b2db9a1fe6eae5 to your computer and use it in GitHub Desktop.
Rapid API Prototyping with Bottle.py - API.py v1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
####################### Import Libraries ####################### | |
import os.path | |
from bottle import route, run, response, static_file, request, error, Bottle, template | |
from json import dumps, loads, load | |
####################### WebService Route / ####################### | |
class API: | |
def __init__(self, port, local): | |
self._app = Bottle() | |
self._local = local | |
self._port = port | |
if local: | |
self._host = '127.0.0.1' | |
else: | |
self._host = '0.0.0.0' | |
def start(self): | |
self._app.run(server='paste', host=self._host, port=self._port) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment