1212
1313
1414class EwonClient (object ):
15- def __init__ (self , account , username , password ):
15+ def __init__ (self , account , username , password , timeout = None ):
1616 self .account = account
1717 self .username = username
1818 self .password = password
19+ self .timeout = timeout
1920 self .data = {
2021 "t2maccount" : account ,
2122 "t2musername" : username ,
@@ -34,7 +35,7 @@ def _build_url(self, url):
3435
3536 def _request (self , url , data , check_success = True ):
3637 try :
37- response = self .session .post (url = url , data = data )
38+ response = self .session .post (url = url , data = data , timeout = self . timeout )
3839 except requests .exceptions .ConnectionError as e : # pragma: nocover
3940 raise DataMailboxConnectionError (str (e )) # pragma: nocover
4041 if response .status_code != 200 :
@@ -62,8 +63,8 @@ class DataMailbox(EwonClient):
6263 This client only supports: getstatus, getewons, getewon, syncdata
6364 """
6465
65- def __init__ (self , account , username , password , devid ):
66- super ().__init__ (account , username , password )
66+ def __init__ (self , account , username , password , devid , timeout = None ):
67+ super ().__init__ (account , username , password , timeout )
6768 self .data ["t2mdevid" ] = devid
6869 self .base_url = "https://data.talk2m.com/"
6970
@@ -151,8 +152,8 @@ class M2Web(EwonClient):
151152 This client only supports: getaccountinfo, getewons, getewon
152153 """
153154
154- def __init__ (self , account , username , password , devid ):
155- super ().__init__ (account , username , password )
155+ def __init__ (self , account , username , password , devid , timeout = None ):
156+ super ().__init__ (account , username , password , timeout )
156157 self .data ["t2mdeveloperid" ] = devid
157158 self .base_url = "https://m2web.talk2m.com/t2mapi/"
158159
0 commit comments