3
3
"""
4
4
bandwidth
5
5
6
- This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
6
+ This file was automatically generated by APIMATIC v3.0 (
7
+ https://www.apimatic.io ).
7
8
"""
8
9
9
10
from enum import Enum
@@ -21,7 +22,7 @@ class Server(Enum):
21
22
"""An enum for API servers"""
22
23
DEFAULT = 0
23
24
MESSAGINGDEFAULT = 1
24
- TWOFACTORAUTHDEFAULT = 2
25
+ MULTIFACTORAUTHDEFAULT = 2
25
26
PHONENUMBERLOOKUPDEFAULT = 3
26
27
VOICEDEFAULT = 4
27
28
WEBRTCDEFAULT = 5
@@ -47,6 +48,14 @@ def max_retries(self):
47
48
def backoff_factor (self ):
48
49
return self ._backoff_factor
49
50
51
+ @property
52
+ def retry_statuses (self ):
53
+ return self ._retry_statuses
54
+
55
+ @property
56
+ def retry_methods (self ):
57
+ return self ._retry_methods
58
+
50
59
@property
51
60
def environment (self ):
52
61
return self ._environment
@@ -64,12 +73,12 @@ def messaging_basic_auth_password(self):
64
73
return self ._messaging_basic_auth_password
65
74
66
75
@property
67
- def two_factor_auth_basic_auth_user_name (self ):
68
- return self ._two_factor_auth_basic_auth_user_name
76
+ def multi_factor_auth_basic_auth_user_name (self ):
77
+ return self ._multi_factor_auth_basic_auth_user_name
69
78
70
79
@property
71
- def two_factor_auth_basic_auth_password (self ):
72
- return self ._two_factor_auth_basic_auth_password
80
+ def multi_factor_auth_basic_auth_password (self ):
81
+ return self ._multi_factor_auth_basic_auth_password
73
82
74
83
@property
75
84
def phone_number_lookup_basic_auth_user_name (self ):
@@ -95,19 +104,16 @@ def web_rtc_basic_auth_user_name(self):
95
104
def web_rtc_basic_auth_password (self ):
96
105
return self ._web_rtc_basic_auth_password
97
106
98
- def __init__ (self , timeout = 60 , max_retries = 3 , backoff_factor = 0 ,
99
- environment = Environment .PRODUCTION ,
100
- base_url = 'https://www.example.com' ,
101
- messaging_basic_auth_user_name = 'TODO: Replace' ,
102
- messaging_basic_auth_password = 'TODO: Replace' ,
103
- two_factor_auth_basic_auth_user_name = 'TODO: Replace' ,
104
- two_factor_auth_basic_auth_password = 'TODO: Replace' ,
105
- phone_number_lookup_basic_auth_user_name = 'TODO: Replace' ,
106
- phone_number_lookup_basic_auth_password = 'TODO: Replace' ,
107
- voice_basic_auth_user_name = 'TODO: Replace' ,
108
- voice_basic_auth_password = 'TODO: Replace' ,
109
- web_rtc_basic_auth_user_name = 'TODO: Replace' ,
110
- web_rtc_basic_auth_password = 'TODO: Replace' ):
107
+ def __init__ (
108
+ self , timeout = 60 , max_retries = 0 , backoff_factor = 2 ,
109
+ retry_statuses = [408 , 413 , 429 , 500 , 502 , 503 , 504 , 521 , 522 , 524 , 408 , 413 , 429 , 500 , 502 , 503 , 504 , 521 , 522 , 524 ],
110
+ retry_methods = ['GET' , 'PUT' , 'GET' , 'PUT' ], environment = Environment .PRODUCTION , base_url = 'https://www.example.com' ,
111
+ messaging_basic_auth_user_name = 'TODO: Replace' , messaging_basic_auth_password = 'TODO: Replace' ,
112
+ multi_factor_auth_basic_auth_user_name = 'TODO: Replace' , multi_factor_auth_basic_auth_password = 'TODO: Replace' ,
113
+ phone_number_lookup_basic_auth_user_name = 'TODO: Replace' , phone_number_lookup_basic_auth_password = 'TODO: Replace' ,
114
+ voice_basic_auth_user_name = 'TODO: Replace' , voice_basic_auth_password = 'TODO: Replace' ,
115
+ web_rtc_basic_auth_user_name = 'TODO: Replace' , web_rtc_basic_auth_password = 'TODO: Replace'
116
+ ):
111
117
# The value to use for connection timeout
112
118
self ._timeout = timeout
113
119
@@ -119,6 +125,12 @@ def __init__(self, timeout=60, max_retries=3, backoff_factor=0,
119
125
# `{backoff factor} * (2 ** ({number of total retries} - 1))`
120
126
self ._backoff_factor = backoff_factor
121
127
128
+ # The http statuses on which retry is to be done
129
+ self ._retry_statuses = retry_statuses
130
+
131
+ # The http methods on which retry is to be done
132
+ self ._retry_methods = retry_methods
133
+
122
134
# Current API environment
123
135
self ._environment = environment
124
136
@@ -132,10 +144,10 @@ def __init__(self, timeout=60, max_retries=3, backoff_factor=0,
132
144
self ._messaging_basic_auth_password = messaging_basic_auth_password
133
145
134
146
# The username to use with basic authentication
135
- self ._two_factor_auth_basic_auth_user_name = two_factor_auth_basic_auth_user_name
147
+ self ._multi_factor_auth_basic_auth_user_name = multi_factor_auth_basic_auth_user_name
136
148
137
149
# The password to use with basic authentication
138
- self ._two_factor_auth_basic_auth_password = two_factor_auth_basic_auth_password
150
+ self ._multi_factor_auth_basic_auth_password = multi_factor_auth_basic_auth_password
139
151
140
152
# The username to use with basic authentication
141
153
self ._phone_number_lookup_basic_auth_user_name = phone_number_lookup_basic_auth_user_name
@@ -159,11 +171,11 @@ def __init__(self, timeout=60, max_retries=3, backoff_factor=0,
159
171
self ._http_client = self .create_http_client ()
160
172
161
173
def clone_with (self , timeout = None , max_retries = None , backoff_factor = None ,
162
- environment = None , base_url = None ,
163
- messaging_basic_auth_user_name = None ,
174
+ retry_statuses = None , retry_methods = None , environment = None ,
175
+ base_url = None , messaging_basic_auth_user_name = None ,
164
176
messaging_basic_auth_password = None ,
165
- two_factor_auth_basic_auth_user_name = None ,
166
- two_factor_auth_basic_auth_password = None ,
177
+ multi_factor_auth_basic_auth_user_name = None ,
178
+ multi_factor_auth_basic_auth_password = None ,
167
179
phone_number_lookup_basic_auth_user_name = None ,
168
180
phone_number_lookup_basic_auth_password = None ,
169
181
voice_basic_auth_user_name = None ,
@@ -173,12 +185,14 @@ def clone_with(self, timeout=None, max_retries=None, backoff_factor=None,
173
185
timeout = timeout or self .timeout
174
186
max_retries = max_retries or self .max_retries
175
187
backoff_factor = backoff_factor or self .backoff_factor
188
+ retry_statuses = retry_statuses or self .retry_statuses
189
+ retry_methods = retry_methods or self .retry_methods
176
190
environment = environment or self .environment
177
191
base_url = base_url or self .base_url
178
192
messaging_basic_auth_user_name = messaging_basic_auth_user_name or self .messaging_basic_auth_user_name
179
193
messaging_basic_auth_password = messaging_basic_auth_password or self .messaging_basic_auth_password
180
- two_factor_auth_basic_auth_user_name = two_factor_auth_basic_auth_user_name or self .two_factor_auth_basic_auth_user_name
181
- two_factor_auth_basic_auth_password = two_factor_auth_basic_auth_password or self .two_factor_auth_basic_auth_password
194
+ multi_factor_auth_basic_auth_user_name = multi_factor_auth_basic_auth_user_name or self .multi_factor_auth_basic_auth_user_name
195
+ multi_factor_auth_basic_auth_password = multi_factor_auth_basic_auth_password or self .multi_factor_auth_basic_auth_password
182
196
phone_number_lookup_basic_auth_user_name = phone_number_lookup_basic_auth_user_name or self .phone_number_lookup_basic_auth_user_name
183
197
phone_number_lookup_basic_auth_password = phone_number_lookup_basic_auth_password or self .phone_number_lookup_basic_auth_password
184
198
voice_basic_auth_user_name = voice_basic_auth_user_name or self .voice_basic_auth_user_name
@@ -188,11 +202,12 @@ def clone_with(self, timeout=None, max_retries=None, backoff_factor=None,
188
202
189
203
return Configuration (
190
204
timeout = timeout , max_retries = max_retries ,
191
- backoff_factor = backoff_factor , environment = environment , base_url = base_url ,
205
+ backoff_factor = backoff_factor , retry_statuses = retry_statuses ,
206
+ retry_methods = retry_methods , environment = environment , base_url = base_url ,
192
207
messaging_basic_auth_user_name = messaging_basic_auth_user_name ,
193
208
messaging_basic_auth_password = messaging_basic_auth_password ,
194
- two_factor_auth_basic_auth_user_name = two_factor_auth_basic_auth_user_name ,
195
- two_factor_auth_basic_auth_password = two_factor_auth_basic_auth_password ,
209
+ multi_factor_auth_basic_auth_user_name = multi_factor_auth_basic_auth_user_name ,
210
+ multi_factor_auth_basic_auth_password = multi_factor_auth_basic_auth_password ,
196
211
phone_number_lookup_basic_auth_user_name = phone_number_lookup_basic_auth_user_name ,
197
212
phone_number_lookup_basic_auth_password = phone_number_lookup_basic_auth_password ,
198
213
voice_basic_auth_user_name = voice_basic_auth_user_name ,
@@ -204,22 +219,24 @@ def clone_with(self, timeout=None, max_retries=None, backoff_factor=None,
204
219
def create_http_client (self ):
205
220
return RequestsClient (timeout = self .timeout ,
206
221
max_retries = self .max_retries ,
207
- backoff_factor = self .backoff_factor )
222
+ backoff_factor = self .backoff_factor ,
223
+ retry_statuses = self .retry_statuses ,
224
+ retry_methods = self .retry_methods )
208
225
209
226
# All the environments the SDK can run in
210
227
environments = {
211
228
Environment .PRODUCTION : {
212
229
Server .DEFAULT : 'api.bandwidth.com' ,
213
230
Server .MESSAGINGDEFAULT : 'https://messaging.bandwidth.com/api/v2' ,
214
- Server .TWOFACTORAUTHDEFAULT : 'https://mfa.bandwidth.com/api/v1' ,
231
+ Server .MULTIFACTORAUTHDEFAULT : 'https://mfa.bandwidth.com/api/v1' ,
215
232
Server .PHONENUMBERLOOKUPDEFAULT : 'https://numbers.bandwidth.com/api/v1' ,
216
233
Server .VOICEDEFAULT : 'https://voice.bandwidth.com' ,
217
234
Server .WEBRTCDEFAULT : 'https://api.webrtc.bandwidth.com/v1'
218
235
},
219
236
Environment .CUSTOM : {
220
237
Server .DEFAULT : '{base_url}' ,
221
238
Server .MESSAGINGDEFAULT : '{base_url}' ,
222
- Server .TWOFACTORAUTHDEFAULT : '{base_url}' ,
239
+ Server .MULTIFACTORAUTHDEFAULT : '{base_url}' ,
223
240
Server .PHONENUMBERLOOKUPDEFAULT : '{base_url}' ,
224
241
Server .VOICEDEFAULT : '{base_url}' ,
225
242
Server .WEBRTCDEFAULT : '{base_url}'
0 commit comments