-
Notifications
You must be signed in to change notification settings - Fork 1
/
list_all_waivers.py
73 lines (53 loc) · 2.48 KB
/
list_all_waivers.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Copyright 2017 Smartwaiver
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from datetime import datetime
from datetime import timezone
import smartwaiver
# The API Key for your account
api_key = '[INSERT API KEY]'
# Set up your Smartwaiver connection using your API Key
sw = smartwaiver.Smartwaiver(api_key)
# Get a list of recent signed waivers for this account
summaries = sw.get_waiver_summaries()
# List waiver ID and title for each summary returned
print('List all waivers:\n')
for summary in summaries:
print(summary.waiver_id + ': ' + summary.title)
# Specify parameters for listing signed waivers
# These are the default values
# Limit number of waivers returned to twenty (Allowed values: 1-100)
limit = 20
# Do not care about whether the waiver has been verified by email or not (Allowed values: true, false, None)
verified = None
# Do not limit the waivers returned to a specific template (Allowed values: Valid template ID)
template_id = ''
# Do not enforce a date range on the query for waivers (Allowed values: ISO 8601 Date) (Requires to_dts parameter)
from_dts = ''
# Used with 'from_dts' to provide the date range (Allowed values: ISO 8601 Date) (Requires from_dts parameter)
to_dts = ''
# This will return the the same as the above query because these are the default values
waiver_summaries = sw.get_waiver_summaries(limit, verified, template_id, from_dts, to_dts)
# An example limiting the parameters
# Limit number returned to 5
limit = 5
# Limit only to waivers that were signed at a kiosk or verified over email
verified = True
# Limit query to waivers of this template ID
template_id = '[INSERT TEMPLATE ID]'
# Limit to waivers signed in November of 2016
from_dts = datetime(2016, 11, 1, tzinfo=timezone.utc).isoformat()
to_dts = datetime(2016, 12, 1, tzinfo=timezone.utc).isoformat()
waiver_summaries = sw.get_waiver_summaries(limit, verified, template_id, from_dts, to_dts)
# View all accessible properties of a waiver summary object in:
# examples/waivers/WaiverSummaryProperties.php