@@ -76,26 +76,27 @@ def __date(period: int) -> Tuple[int]:
7676 }
7777 return exception
7878
79- def get_currency (self ) -> Tuple [int , Dict | List [Dict ]]:
79+ def get_currency (self ) -> Tuple [Dict | List [Dict ]]:
8080 try :
8181 session = self .session ()
8282 uri = self .mono_currency_uri
8383 response = session .get (uri )
8484 code = response .status_code
8585 response .raise_for_status ()
86- return code , response .json ()
86+ return response .json ()
8787 except requests .exceptions .HTTPError as exc :
8888 error_response = {
89+ "code" : code ,
8990 "detail" : str (exc )
9091 }
91- return code , error_response
92+ return error_response
9293 except Exception as exc :
9394 exception = {
9495 "detail" : str (exc )
9596 }
9697 return exception
9798
98- def get_client_info (self ) -> Tuple [int , Dict | List [Dict ]]:
99+ def get_client_info (self ) -> Tuple [Dict | List [Dict ]]:
99100 try :
100101 session = self .session ()
101102 token = self .token
@@ -104,53 +105,55 @@ def get_client_info(self) -> Tuple[int, Dict | List[Dict]]:
104105 response = session .get (uri , headers = headers )
105106 code = response .status_code
106107 response .raise_for_status ()
107- return code , response .json ()
108+ return response .json ()
108109 except requests .exceptions .HTTPError as exc :
109110 error_response = {
111+ "code" : code ,
110112 "detail" : str (exc )
111113 }
112- return code , error_response
114+ return error_response
113115 except Exception as exc :
114116 exception = {
115117 "detail" : str (exc )
116118 }
117119 return exception
118120
119- def get_balance (self ) -> Tuple [int , Dict | List [Dict ]]:
121+ def get_balance (self ) -> Tuple [Dict | List [Dict ]]:
120122 try :
121123 response = self .get_client_info ()
122- code = response [0 ]
123- payload = response [1 ]
124124 balance = {
125- 'balance' : payload ["accounts" ][0 ]["balance" ] / 100
125+ 'balance' : response ["accounts" ][0 ]["balance" ] / 100
126126 }
127- return code , balance
127+ return balance
128128 except Exception :
129129 return response
130130
131- def get_statement (self , period : int ) -> Tuple [int , Dict | List [Dict ]]:
131+ def get_statement (self , period : int ) -> Tuple [Dict | List [Dict ]]:
132132 try :
133133 session = self .session ()
134134 token = self .token
135135 uri = self .mono_statement_uri
136136 headers = {"X-Token" : token }
137137 time_delta = self .__date (period )
138- response = session .get (f"{ uri } { time_delta } /" , headers = headers )
138+ response = session .get (
139+ f"{ uri } { time_delta } /" , headers = headers
140+ )
139141 code = response .status_code
140142 response .raise_for_status ()
141- return code , response .json ()
143+ return response .json ()
142144 except requests .exceptions .HTTPError as exc :
143145 error_response = {
146+ "code" : code ,
144147 "detail" : str (exc )
145148 }
146- return code , error_response
149+ return error_response
147150 except Exception as exc :
148151 exception = {
149152 "detail" : str (exc )
150153 }
151154 return exception
152155
153- def create_webhook (self , webhook : str ) -> Tuple [int , Dict | List [Dict ]]:
156+ def create_webhook (self , webhook : str ) -> Tuple [Dict | List [Dict ]]:
154157 try :
155158 session = self .session ()
156159 token = self .token
@@ -159,12 +162,13 @@ def create_webhook(self, webhook: str) -> Tuple[int, Dict | List[Dict]]:
159162 response = session .post (uri , headers = headers , data = webhook )
160163 code = response .status_code
161164 response .raise_for_status ()
162- return code , response .json ()
165+ return response .json ()
163166 except requests .exceptions .HTTPError as exc :
164167 error_response = {
168+ "code" : code ,
165169 "detail" : str (exc )
166170 }
167- return code , error_response
171+ return error_response
168172 except Exception as exc :
169173 exception = {
170174 "detail" : str (exc )
0 commit comments