33"""
44bandwidth
55
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 ).
78"""
89
910from enum import Enum
@@ -21,7 +22,7 @@ class Server(Enum):
2122 """An enum for API servers"""
2223 DEFAULT = 0
2324 MESSAGINGDEFAULT = 1
24- TWOFACTORAUTHDEFAULT = 2
25+ MULTIFACTORAUTHDEFAULT = 2
2526 PHONENUMBERLOOKUPDEFAULT = 3
2627 VOICEDEFAULT = 4
2728 WEBRTCDEFAULT = 5
@@ -47,6 +48,14 @@ def max_retries(self):
4748 def backoff_factor (self ):
4849 return self ._backoff_factor
4950
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+
5059 @property
5160 def environment (self ):
5261 return self ._environment
@@ -64,12 +73,12 @@ def messaging_basic_auth_password(self):
6473 return self ._messaging_basic_auth_password
6574
6675 @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
6978
7079 @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
7382
7483 @property
7584 def phone_number_lookup_basic_auth_user_name (self ):
@@ -95,19 +104,16 @@ def web_rtc_basic_auth_user_name(self):
95104 def web_rtc_basic_auth_password (self ):
96105 return self ._web_rtc_basic_auth_password
97106
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+ ):
111117 # The value to use for connection timeout
112118 self ._timeout = timeout
113119
@@ -119,6 +125,12 @@ def __init__(self, timeout=60, max_retries=3, backoff_factor=0,
119125 # `{backoff factor} * (2 ** ({number of total retries} - 1))`
120126 self ._backoff_factor = backoff_factor
121127
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+
122134 # Current API environment
123135 self ._environment = environment
124136
@@ -132,10 +144,10 @@ def __init__(self, timeout=60, max_retries=3, backoff_factor=0,
132144 self ._messaging_basic_auth_password = messaging_basic_auth_password
133145
134146 # 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
136148
137149 # 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
139151
140152 # The username to use with basic authentication
141153 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,
159171 self ._http_client = self .create_http_client ()
160172
161173 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 ,
164176 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 ,
167179 phone_number_lookup_basic_auth_user_name = None ,
168180 phone_number_lookup_basic_auth_password = None ,
169181 voice_basic_auth_user_name = None ,
@@ -173,12 +185,14 @@ def clone_with(self, timeout=None, max_retries=None, backoff_factor=None,
173185 timeout = timeout or self .timeout
174186 max_retries = max_retries or self .max_retries
175187 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
176190 environment = environment or self .environment
177191 base_url = base_url or self .base_url
178192 messaging_basic_auth_user_name = messaging_basic_auth_user_name or self .messaging_basic_auth_user_name
179193 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
182196 phone_number_lookup_basic_auth_user_name = phone_number_lookup_basic_auth_user_name or self .phone_number_lookup_basic_auth_user_name
183197 phone_number_lookup_basic_auth_password = phone_number_lookup_basic_auth_password or self .phone_number_lookup_basic_auth_password
184198 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,
188202
189203 return Configuration (
190204 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 ,
192207 messaging_basic_auth_user_name = messaging_basic_auth_user_name ,
193208 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 ,
196211 phone_number_lookup_basic_auth_user_name = phone_number_lookup_basic_auth_user_name ,
197212 phone_number_lookup_basic_auth_password = phone_number_lookup_basic_auth_password ,
198213 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,
204219 def create_http_client (self ):
205220 return RequestsClient (timeout = self .timeout ,
206221 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 )
208225
209226 # All the environments the SDK can run in
210227 environments = {
211228 Environment .PRODUCTION : {
212229 Server .DEFAULT : 'api.bandwidth.com' ,
213230 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' ,
215232 Server .PHONENUMBERLOOKUPDEFAULT : 'https://numbers.bandwidth.com/api/v1' ,
216233 Server .VOICEDEFAULT : 'https://voice.bandwidth.com' ,
217234 Server .WEBRTCDEFAULT : 'https://api.webrtc.bandwidth.com/v1'
218235 },
219236 Environment .CUSTOM : {
220237 Server .DEFAULT : '{base_url}' ,
221238 Server .MESSAGINGDEFAULT : '{base_url}' ,
222- Server .TWOFACTORAUTHDEFAULT : '{base_url}' ,
239+ Server .MULTIFACTORAUTHDEFAULT : '{base_url}' ,
223240 Server .PHONENUMBERLOOKUPDEFAULT : '{base_url}' ,
224241 Server .VOICEDEFAULT : '{base_url}' ,
225242 Server .WEBRTCDEFAULT : '{base_url}'
0 commit comments