예제 #1
0
    search_terms = entry.split('\n')

    search_engine_id = request.form['search_engine_id']
    api_key = request.form['api_key']
    safe_search_level = request.form['safe_search_level']
    picture_rights = request.form['picture_rights']

    try:
        num_results_per_term = int(request.form['results_per_term'])
    except ValueError:
        num_results_per_term = 10

    service = build('customsearch', 'v1', developerKey=api_key)

    results_dictionary = {}
    for term in search_terms:
        res = service.cse().list(q=term,
                                 cx=search_engine_id,
                                 searchType='image',
                                 num=num_results_per_term,
                                 safe=safe_search_level,
                                 rights=picture_rights).execute()
        results_dictionary[term] = res

    return render_template('results.html', results=results_dictionary)


if __name__ == '__main__':
    app.config['TRAP_BAD_REQUEST_ERRORS'] = True
    app.run(debug=True)
예제 #2
0
#!/usr/bin/env python3

from lib import app

if __name__ == '__main__':
    from lib import getConfig
    app.run(host='0.0.0.0', port=getConfig('server/port', 80))
예제 #3
0
from lib import app
import c

if __name__ == '__main__':
    app.run(debug=True, host='0.0.0.0', port=5000)
예제 #4
0
#!/usr/bin/env python3.4
import sys
sys.path.append('/aux0/customer/containers/ockvsman/')
from lib import app


app.run('0.0.0.0', port = 9002, debug = True)
예제 #5
0
from lib import app

if __name__ == '__main__':
    app = app.App()
    app.run()
from lib import app
app.run(host='127.0.0.1', port=5000, debug=True)
예제 #7
0
def main():
    app.run(default_configfile, base_conf, argparser.parse_args())
예제 #8
0
import os

from lib import app, views

if __name__ == "__main__":
    app.run(host=os.environ.get("IP"),
            port=int(os.environ.get("PORT")),
            debug=os.environ.get("DEBUG"))
예제 #9
0
def main():
    from lib import app
    app.run(debug=True)
예제 #10
0
    args = {"name": fields.Str(required=True),
            "username": fields.Str(required=True),
            "pass1": fields.Str(required=True),
            "pass2": fields.Str(required=True),
            "email": fields.Str(required=True, validate=validate_email)}

    args = parser.parse(args, request, validate=lambda args: args['pass1'] == args['pass2'])

    new_user = Person()
    new_user.name = args['name']
    new_user.username = args['username']
    print args['pass1']
    new_user.password = encryptor.dumps(args['pass1'])
    print new_user.password
    new_user.email = args['email']
    new_user.avatar = None

    dbadd(new_user)
    return redirect('/login')


@app.errorhandler(500)
def errorstuff(error):
    print traceback.print_tb(sys.exc_traceback)
    return 'ERROR:' + str(error.message) + str(traceback.format_tb(sys.exc_traceback))


if __name__ == '__main__':
    app.jinja_env.filters['content_title_filter'] = content_title_filter
    app.run(host='0.0.0.0', port=7500) # , use_reloader=True)
예제 #11
0
from lib import app
app.run(host='127.0.0.1', port=5000, debug=True)