4
4
5
5
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
6
6
7
- OpenAPI spec version: 1.0.43
7
+ OpenAPI spec version: 1.0.44
8
8
9
9
Generated by: https://github.com/swagger-api/swagger-codegen.git
10
10
"""
@@ -23,16 +23,20 @@ def __init__(self, text, status_code):
23
23
class ApiClient (object ):
24
24
def __init__ (self ):
25
25
self .host = "https://mandrillapp.com/api/1.0"
26
- self .user_agent = 'Swagger-Codegen/1.0.43 /python'
26
+ self .user_agent = 'Swagger-Codegen/1.0.44 /python'
27
27
self .format_list = ['json' , 'xml' , 'php' , 'yaml' ]
28
28
self .content_type = 'application/json'
29
29
self .default_output_format = 'json'
30
30
self .accepts = ['application/json' , 'application/xml' , 'application/x-php' , 'application/x-yaml; charset=utf-8' ]
31
+ self .timeout = 300
31
32
32
33
def set_default_output_format (self , output_format ):
33
34
if output_format in self .format_list :
34
35
self .default_output_format = output_format
35
36
37
+ def set_timeout (self , timeout ):
38
+ self .timeout = timeout
39
+
36
40
def call_api (self , resource_path , method , header_params = None , body = None , ** kwargs ):
37
41
# header parameters
38
42
headers = header_params or {}
@@ -52,7 +56,7 @@ def call_api(self, resource_path, method, header_params=None, body=None, **kwarg
52
56
use_default_output_format = False
53
57
54
58
if use_default_output_format and self .default_output_format in self .format_list :
55
- url += '.%s' % self .default_output_format
59
+ url += '.%s' % self .default_output_format
56
60
57
61
# perform request and return response
58
62
res = self .request (method , url , body , headers )
@@ -73,7 +77,10 @@ def call_api(self, resource_path, method, header_params=None, body=None, **kwarg
73
77
else :
74
78
return res
75
79
76
- def request (self , method , url , body = None , headers = None , timeout = 300.0 ):
80
+ def request (self , method , url , body = None , headers = None , timeout = None ):
81
+ if not timeout :
82
+ timeout = self .timeout
83
+
77
84
if method == 'POST' :
78
85
return requests .post (url , data = json .dumps (body ), headers = headers , timeout = timeout )
79
86
else :
0 commit comments