Esempio n. 1
0
def envelope_list():
    """Request for envelope list"""
    try:
        envelope_args = {'from_date': request.args.get('from-date')}
    except TypeError:
        return jsonify(message='Invalid JSON input'), 400

    try:
        user_documents = session.get('ds_documents')
        if not user_documents:
            user_documents = []
        envelopes = Envelope.list(envelope_args, user_documents)
    except ApiException as ex:
        return process_error(ex)
    return jsonify({'envelopes': envelopes})
Esempio n. 2
0
def envelope_list():
    try:
        req_json = request.get_json(force=True)
        envelope_args = {
            'account_id': req_json['account-id'],
            'from_date': req_json['from-date'],
            "base_path": req_json['base-path'],
            'access_token': request.headers.get('Authorization').replace('Bearer ', '')
        }
    except TypeError:
        return jsonify(message="Invalid json input"), 400

    try:
        envelopes_information = Envelope.list(envelope_args)
    except ApiException as e:
        return jsonify({'error': e.body.decode('utf-8')}), 400
    return jsonify({"envelopes": envelopes_information.to_dict()})