Created
October 30, 2019 16:55
-
-
Save atomize/278b578bf79751cc03203606847432bb to your computer and use it in GitHub Desktop.
This file contains hidden or 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
from flask import Flask, jsonify, request | |
from flask_cors import CORS | |
import usaddress | |
app = Flask(__name__) | |
CORS(app) | |
def addressmaker(inputarr): | |
newarr = [] | |
for x in inputarr: | |
newarr.append(usaddress.tag(x)) | |
return newarr | |
@app.route('/address', methods=['POST']) | |
def postJsonHandler(): | |
req = request.get_json()['data'] | |
return_object = usaddress.tag(req) if type(req) is str else addressmaker(req) | |
return jsonify(return_object) | |
if __name__ == '__main__': | |
app.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment