Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
33 lines (26 sloc) 1 KB
from flask import Flask, request
from imo import Endpoint, Portal
app = Flask(__name__)
def get_args(request_args, required, optional):
args = {}
for arg in required:
args[arg] = request_args[arg]
for arg in optional:
if arg in request_args:
args[arg] = request_args[arg]
return args
def search():
return str(**get_args(request.args, ['query', 'result_size'], ['dym_size', 'filter', 'format', 'page'])))
def count():
return str(portal.count(**get_args(request.args, ['query'], ['filter', 'format'])))
def detail():
return str(**get_args(request.args, ['code', 'payload'], [])))
def cross():
return str(portal.cross(**get_args(request.args, ['segment_id'], ['codes_a', 'codes_b'])))
if __name__ == '__main__':
portal = Portal(org_id='36b2cee0ad54b925', host=Endpoint.SANDBOX, port=42011)'', port=88, debug=True)
Jump to Line
Something went wrong with that request. Please try again.