Example #1
0
def handshake():
    global stored_person
    incoming_json = request.get_json()
    print incoming_json
    target_id = incoming_json['target_system_id']
    user_id = incoming_json['username']

    # find our  user data and put it in the bucket
    try:
        u = User.objects(pk=user_id)[0]
        p = Person.objects(pk=user_id)[0]
        print u
        print p
        stored_person = p
        bucket.put(target_id, user_id, p)
    except ValidationError:
        return jsonify({
            'acknowledgement': False,
            'message': 'Could not find user with ID %s' % user_id
        })

    return jsonify({
        'acknowledgement': True,
        'messsage': 'Sending data to target %s' % target_id
    })
Example #2
0
    def __init__(self):
        people = Person.objects()

        self.target_systems = {}

        # populate some dummy data in the bucket
        p = Person()
        p.first_name = 'test'
        p.last_name = 'test test'

        self.target_systems['test_doctor_123'] = {}
        for p in people:
            self.target_systems['test_doctor_123'][str(p.id)] = p
Example #3
0
def handshake():
    global stored_person
    incoming_json = request.get_json()
    print incoming_json
    target_id = incoming_json['target_system_id']
    user_id = incoming_json['username']

    # find our  user data and put it in the bucket
    try:
        u = User.objects(pk=user_id)[0]
        p = Person.objects(pk=user_id)[0]
        print u
        print p
        stored_person = p
        bucket.put(target_id, user_id, p)
    except ValidationError:
        return jsonify({'acknowledgement': False, 'message': 'Could not find user with ID %s' % user_id})

    return jsonify({'acknowledgement': True, 'messsage': 'Sending data to target %s' % target_id})