from utils import app, conn import requests import db db.create_table(conn) if __name__ == "__main__": app.run(host='127.0.0.1:5000', threaded=True)
from utils import app from handlers import * if __name__ == '__main__': app.debug = True app.run(host='0.0.0.0', port=5000)
return "<h1> Error! </h1> <p> You need to specify a card number, CVC and expiry date. </p>" return add_cc(username, is_primary, cardnumber, cvc, expirydate) elif payment == "Riseup": riseup_public_key = content.get('publickey') if not riseup_public_key: return "<h1> Error! </h1> <p> You need to specify a Riseup Public Key. </p>" return add_riseup(username, is_primary, riseup_public_key) elif payment == "Paypal": ppuser, pppass = content.get("ppusername"), content.get("pppassword") if not ppuser or not pppass: return "<h1> Error! </h1> <p> You need to specify a Paypal username and password. </p>" return add_paypal(username, is_primary, ppuser, pppass) else: return "<h1> Error! </h1> <p> You need to input a payment type. We support Riseup Wallet, Credit Card and Paypal.</p> " return add_payment_method() @app.route("/paymentmethods") @cross_origin() def get_payments(): username = request.args.get('username') if not username: return "<h1> Error </h1> <p> You can only view the payment data if you specify the user! </h1>" return show_all_payment(username) if __name__ == '__main__': app.run(port=port) tunnel.close() print("Closed tunnel.")
import sys, os sys.path.append(os.getcwd() + os.path.sep + 'python') sys.path.append(os.getcwd() + os.path.sep) from utils import app from apis import * from views import * if __name__ == '__main__': app.run(threaded=True, host="0.0.0.0", port=5005)
import controllers.data import controllers.file import controllers.index import controllers.user from database import engine, init_db from flask_cors import CORS from utils import app CORS(app) if __name__ == '__main__': init_db(engine) app.run(host='0.0.0.0', debug=True)
from utils import app from flask import send_from_directory from api.helloApi import MapApiHandler from api.googleApi import GoogleApiHandler from api.googleApi2 import GoogleApiHandler2 from flask_cors import CORS # comment this on deployment from flask_restful import Api CORS(app) # comment this on deployment api = Api(app) map = MapApiHandler() google = GoogleApiHandler() google2 = GoogleApiHandler2() # signup = HelloApiHandler() # signup = HelloApiHandler() @app.route("/", defaults={'path': ''}) def serve(path): return send_from_directory(app.static_folder, 'index.html') api.add_resource(map, '/map', endpoint='map') api.add_resource(google2, '/trip', endpoint='trip') api.add_resource(google, '/recommend', endpoint='recommend') # api.add_resource(signup, '/signup', endpoint='signup') if __name__ == '__main__': app.run(debug=True)
from flask_graphql import GraphQLView import graphene from schema import Mutation, Query from utils import app, db schema = graphene.Schema(query=Query, mutation=Mutation) # Basic GraphQL set-up app.add_url_rule('/graphql', view_func=GraphQLView.as_view('graphql', schema=schema, graphiql=True)) @app.route('/') def index(): welcome_header = '<h1>Welcome to my store!</h1>' advertisement = '<p>To know more about me, please visit <a href="http://andreiungur.github.io/">my personal web page.</a></p>' graphql_endpoint = '<p>To use this API, visit the GraphQL end-point: <a href="http://127.0.0.1:5000/graphql">/graphql</a></p>' return welcome_header + advertisement + graphql_endpoint if __name__ == '__main__': app.run()
abort(403) @app.route('/api/entities/<id>/path/', methods=['GET']) @login_required def entity_path(id): node = validate_access(g.user["email"], OPERATION_READ, id) if node is not None: return json.dumps({"path": get_entity_path(id)}) else: abort(403) @app.route('/api/groups/<id>/accesslist/', methods=['POST']) @login_required def share_group(id): data = request.get_json(force=True) if str(data["group"]["id"]) != id: abort(400) else: node = validate_ownership(g.user["email"], data["group"]["id"]) if node is not None: existent_rel = validate_membership(data["email"], data["group"]["id"]) if existent_rel is None: add_member(data["email"], data["group"]["id"]) return Response() else: abort(403) if __name__ == "__main__": app.run('0.0.0.0', 5000)