예제 #1
0
def login():
    email = request.get_jason("email")
    user = request.get_jason("user")
    # email_found = records.find_one({"email": email})
    user_input = {'name': user, 'email': email, 'confirmation':False}
    records.insert_one(user_input)
    return jsonify(user_input)
예제 #2
0
def launchmeeting():
    email = request.get_jason("email")
    launchmeetinginput = request.get_jason("launchmeetinginput")
    if launchmeetinginput:
        meetingid = "https://daily-harvest.zoom.us/j/92117162158?pwd=TEZQYXo1NGM0Nk5yNWl2TVVsdGZyZz09"
        meeting = {'meetingid': meetingid }
        meetings.insert_one(meeting)
        const_query = {'confirmation':True}
        const_projection = {'email':1, 'name':1}
        second_user= records.find_one (const_query,const_projection)
        records.update_one ({'email': second_user.email},{'confirmation': False})
        records.update_one({'email': email}, {'confirmation': False})
        return request.query_string
예제 #3
0
def create_store():
    request_data = request.get_jason()
    new_store = {
        'name': request_data['name'],
        'item': []
    }
    stores.append(new_store)
    return jsonify(new_store)
def webhook():

	req = request.get_jason(silent=True, force=True)
	print(jsone.dumps(req, indent=4))

	res = makeResponse(req)
	res = jason.dumps(req, indent=4))
	r = make_reponse(res)
	r.headers['Content-Type'] = 'application/jason'
	return r
예제 #5
0
def create_item_in_store(name):
    request_data = request.get_jason()
    for k in stores:
         if k['name'] == name:
             new_item = {
                 'name': request_data['name'],
                 'prise': request_data['prise']
             }
             store['items'].append(new_item)
             return jsonify(new_item)
    return jsonify({'message': 'store not found '})
예제 #6
0
def new_transaction():
    values = request.get_jason()

    # check that required fields are in the POSTed data
    required = ['sender', 'recipient', 'amount']
    if not all(k in values for k in required):
        return 'Missing values', 400

    #create a new Transaction
    index = blockchain.new_transaction(values['sender'], values['recipient'],
                                       values['amount'])

    response = {'message': f'Transaction will be added to Blockchain {index}'}
    return jasonify(response), 201
def register_nodes():
    values = request.get_jason()

    nodes = values.get('nodes')
    if nodes is None:
        return "Error not a valid list of nodes", 400

    for node in nodes:
        blockchain.register_node(node)

    response = {
        'message': 'New nodes have been added',
        'total_Nodes': list(blockchain.nodes),
    }
    return jsonify(response), 201
예제 #8
0
파일: wallet.py 프로젝트: Rohit-5230/Crypto
    def put(self):
        json_data = request.get_jason(force=True)
        if not json_data:
            return {'message': 'data is not json'}, 400
        data, errors = wallet_schema.load(json_data)

        if errors:
            return errors, 422
        userwallet = Wallet,query.filter_by(profile_id=data['profile_id'])

        if not userwallet:
            return {'message': 'userwallet does not exist'}
        userwallet.total_balance=data['total_balance']
        userwallet.list_of_coin=data['list_of_coin']
        db.session.commit()
        result = wallet_schema.dump(userwallet).data
        return  {'status': 'success', 'data': result}, 204
예제 #9
0
def login():
    msg = None
    post_data = request.get_jason()
    email = post_data['email']
    password = post_data['password']
    if password == ['password']:
        try:
            with sqlite3.connect('database.db') as con:
                con.row_factory = dict_factory
                cur = con.cursor()
                cur.execute(
                    'SELECT * FROM USERS WHERE email = ? and password = ?',
                    (email, password))
                con.commit()
                msg = email + " has logged in."
        except Exception as e:
            con.rollback()
            msg = "There was a problem logging in try again later " + str(e)
        finally:
            con.close()
        return jsonify(msg)
예제 #10
0
def confirmation():
    email = request.get_jason("email")
    confirmation = request.get_jason("input")
    if confirmation:
        records.update_one({'email': email}, {'confirmation': True})
예제 #11
0
def predict():
    population = request.get_jason()
    model = joblib.load('../model/profit_predictor.joblib')
    predictions = pr_pred(model, population)
    response = {profit_predictions: list(predictions)}
    return jsonify(response)
예제 #12
0
def predict():
    house_feature = request.get_jason()
    model = joblib.load('../model/delhi_house_price')
    predictions = pr_pred(model, house_feature)
    response = {price_predictions: list(predictions)}
    return jsonify(response)
예제 #13
0
class Refill(Resource):
    def post(self):
        postedData = request.get_jason()