Skip to content

Commit 4ac0288

Browse files
committed
Fixed type hints in methods of class MonoManager
1 parent d7b208d commit 4ac0288

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

monobank_api_client/managers.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from typing import Tuple, Dict, List
21
import requests
2+
from typing import Dict, List
33
from datetime import datetime
44

55
from .config import (
@@ -61,11 +61,11 @@ def mono_webhook_uri(self, new_uri):
6161
self._mono_webhook_uri = new_uri
6262

6363
@classmethod
64-
def session(cls) -> requests.Session:
64+
def session(cls) -> requests.sessions.Session:
6565
return requests.Session()
6666

6767
@staticmethod
68-
def __date(period: int) -> Tuple[int|Dict]:
68+
def __date(period: int) -> int|Dict:
6969
_day = 86400 # 1 day (UNIX)
7070
try:
7171
time_delta = int(datetime.now().timestamp()) - (period * _day)
@@ -76,7 +76,7 @@ def __date(period: int) -> Tuple[int|Dict]:
7676
}
7777
return exception
7878

79-
def get_currency(self) -> Tuple[Dict|List[Dict]]:
79+
def get_currency(self) -> List[Dict]|Dict:
8080
try:
8181
session = self.session()
8282
uri = self.mono_currency_uri
@@ -96,7 +96,7 @@ def get_currency(self) -> Tuple[Dict|List[Dict]]:
9696
}
9797
return exception
9898

99-
def get_client_info(self) -> Tuple[Dict|List[Dict]]:
99+
def get_client_info(self) -> Dict:
100100
try:
101101
session = self.session()
102102
token = self.token
@@ -118,7 +118,7 @@ def get_client_info(self) -> Tuple[Dict|List[Dict]]:
118118
}
119119
return exception
120120

121-
def get_balance(self) -> Tuple[Dict|List[Dict]]:
121+
def get_balance(self) -> Dict:
122122
try:
123123
response = self.get_client_info()
124124
balance = {
@@ -128,7 +128,7 @@ def get_balance(self) -> Tuple[Dict|List[Dict]]:
128128
except Exception:
129129
return response
130130

131-
def get_statement(self, period: int) -> Tuple[Dict|List[Dict]]:
131+
def get_statement(self, period: int) -> List[Dict]|Dict:
132132
try:
133133
session = self.session()
134134
token = self.token
@@ -153,13 +153,15 @@ def get_statement(self, period: int) -> Tuple[Dict|List[Dict]]:
153153
}
154154
return exception
155155

156-
def create_webhook(self, webhook: str) -> Tuple[Dict|List[Dict]]:
156+
def create_webhook(self, webhook: str) -> Dict:
157157
try:
158158
session = self.session()
159159
token = self.token
160160
uri = self.mono_webhook_uri
161161
headers = {"X-Token": token}
162-
response = session.post(uri, headers=headers, data=webhook)
162+
response = session.post(
163+
uri, headers=headers, data=webhook
164+
)
163165
code = response.status_code
164166
response.raise_for_status()
165167
return response.json()

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def readme():
88

99
setup(
1010
name='monobank_api_client',
11-
version='0.1.7',
11+
version='0.1.8',
1212
author='ihor.sotnyk',
1313
author_email='ihor.sotnyk@onix-systems.com',
1414
description='This module is designed for quick interaction with the monobank API.',

0 commit comments

Comments
 (0)