Skip to content

Commit c1e1b31

Browse files
IgorIgor
authored andcommitted
use None instead of {} as the default value for optional dict arguments
1 parent 87e5559 commit c1e1b31

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

bitrix24/bitrix24.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ async def request(self, method: str, params: str = None) -> Dict[str, Any]:
115115
return response
116116

117117
async def _call(
118-
self, method: str, params: Dict[str, Any] = {}, start: int = 0
118+
self, method: str, params: Dict[str, Any] = None, start: int = 0
119119
) -> Dict[str, Any]:
120120
"""Async call a REST method with specified parameters.
121121
@@ -125,6 +125,8 @@ async def _call(
125125
params (dict): Optional arguments which will be converted to a POST request string
126126
start (int): Offset for pagination
127127
"""
128+
if params is None:
129+
params = {}
128130
params["start"] = start
129131

130132
payload = self._prepare_params(params)
@@ -139,7 +141,7 @@ async def _call(
139141
return res["result"] + result
140142
return res["result"]
141143

142-
def callMethod(self, method: str, params: Dict[str, Any] = {}, **kwargs) -> Dict[str, Any]:
144+
def callMethod(self, method: str, params: Dict[str, Any] = None, **kwargs) -> Dict[str, Any]:
143145
"""Call a REST method with specified parameters.
144146
145147
Parameters
@@ -151,6 +153,8 @@ def callMethod(self, method: str, params: Dict[str, Any] = {}, **kwargs) -> Dict
151153
-------
152154
Returning the REST method response as an array, an object or a scalar
153155
"""
156+
if params is None:
157+
params = {}
154158
if not method or len(method.split(".")) < 2:
155159
raise BitrixError("Wrong method name", 400)
156160

0 commit comments

Comments
 (0)