Skip to content

Commit a48076c

Browse files
committed
cleaned version of send poll API and example
1 parent efc18c6 commit a48076c

3 files changed

Lines changed: 17 additions & 5 deletions

File tree

examples/sendPoll.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,15 @@
66

77

88
def main():
9-
response = greenAPI.sending.sendPoll("11001234567@c.us", "Please choose the color:", [{"optionName": "green"}, {"optionName": "red"}, {"optionName": "blue"}])
9+
response = greenAPI.sending.sendPoll(
10+
"11001234567@c.us",
11+
"Please choose the color:",
12+
[
13+
{"optionName": "green"},
14+
{"optionName": "red"},
15+
{"optionName": "blue"}
16+
]
17+
)
1018

1119
print(response.data)
1220

tests/test_methods.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ def sending_methods(self) -> typing.List[Response]:
107107
api.sending.sendLocation("", 0.0, 0.0),
108108
api.sending.sendContact("", {}),
109109
api.sending.sendLink("", ""),
110-
api.sending.forwardMessages("", "", [])
110+
api.sending.forwardMessages("", "", []),
111+
api.sending.sendPoll("", "", [])
111112
]
112113

113114
@property

whatsapp_api_client_python/tools/sending.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,16 +259,19 @@ def forwardMessages(
259259
"forwardMessages/{{apiTokenInstance}}"
260260
), request_body
261261
)
262-
262+
263263
def sendPoll(
264264
self,
265265
chatId: str,
266266
message: str,
267267
options: List[Dict[str, str]],
268-
multipleAnswers: Optional[str] = False,
268+
multipleAnswers: Optional[bool] = None,
269269
quotedMessageId: Optional[str] = None
270270
) -> Response:
271-
"""The method is aimed for sending a poll."""
271+
"""
272+
The method is intended for sending messages with a poll to a
273+
private or group chat
274+
"""
272275

273276
request_body = self.__handle_parameters(locals())
274277

0 commit comments

Comments
 (0)