-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
42 additions
and
25 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
import logging | ||
import os | ||
import sys | ||
|
||
reload(sys) | ||
cwd = os.getcwd() | ||
sys.path.append(cwd) | ||
sys.setdefaultencoding("utf-8") | ||
logging.basicConfig(format='%(asctime)s %(message)s', level=logging.INFO) |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# -*- coding: utf-8 -*- | ||
import json | ||
import logging | ||
|
||
from bottle import Bottle | ||
|
||
from aore.fias.fiasfactory import FiasFactory | ||
|
||
logging.basicConfig(format='%(asctime)s %(message)s', level=logging.INFO) | ||
app = Bottle() | ||
fias_factory = FiasFactory() | ||
|
||
|
||
@app.route('/expand/<aoid:re:[\w]{8}(-[\w]{4}){3}-[\w]{12}>') | ||
def expand(aoid): | ||
return json.dumps(fias_factory.expand(aoid)) | ||
|
||
|
||
@app.route('/normalize/<aoid:re:[\w]{8}(-[\w]{4}){3}-[\w]{12}>') | ||
def normalize(aoid): | ||
return json.dumps(fias_factory.normalize(aoid)) | ||
|
||
|
||
@app.route('/find/<text>') | ||
@app.route('/find/<text>/<strong>') | ||
def find(text, strong=False): | ||
strong = (strong == "strong") | ||
return json.dumps(fias_factory.find(text, strong)) | ||
|
||
|
||
@app.error(404) | ||
def error404(error): | ||
return json.dumps(dict(error="Page not found")) |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,8 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import os | ||
import sys | ||
from aore import phias | ||
|
||
# append current dir to module path | ||
reload(sys) | ||
cwd = os.path.dirname(os.path.abspath(__file__)) | ||
sys.path.append(cwd) | ||
sys.setdefaultencoding("utf-8") | ||
# sys.path.append('/home/i/interc7j/.local/lib/python2.7/site-packages') | ||
application = phias.app | ||
|
||
from aore import aore | ||
|
||
application = aore.app | ||
if __name__ == '__main__': | ||
application.run(host='localhost', port=55001, debug=True) |