Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,8 @@ onEvent - ваша функция, которая должен содержат
| `account.getStatusInstance` | Метод предназначен для получения состояния сокета соединения инстанса аккаунта с MAX | [GetStatusInstance](https://green-api.com/v3/docs/api/account/GetStatusInstance/) |
| `account.reboot` | Метод предназначен для перезапуска аккаунта | [Reboot](https://green-api.com/v3/docs/api/account/Reboot/) |
| `account.logout` | Метод предназначен для разлогинивания аккаунта | [Logout](https://green-api.com/v3/docs/api/account/Logout/) |
| `account.qr` | Метод предназначен для получения QR кода для авторизации | [QR](https://green-api.com/v3/docs/api/account/qr/) |
| `account.setProfilePicture` | Метод предназначен для установки аватара аккаунта | [SetProfilePicture](https://green-api.com/v3/docs/api/account/SetProfilePicture/) |
| `account.startAuthorization` | Метод предназначен для запроса кода для авторизации | [StartAuthorization](https://green-api.com/v3/docs/api/account/StartAuthorization/) |
| `account.sendAuthorizationCode` | Метод предназначен для авторизации инстанса по номеру телефона | [SendAuthorizationCode](https://green-api.com/v3/docs/api/account/SendAuthorizationCode/) |
| `groups.createGroup` | Метод предназначен для создания группового чата | [CreateGroup](https://green-api.com/v3/docs/api/groups/CreateGroup/) |
| `groups.updateGroupName` | Метод изменяет наименование группового чата | [UpdateGroupName](https://green-api.com/v3/docs/api/groups/UpdateGroupName/) |
| `groups.getGroupData` | Метод получает данные группового чата | [GetGroupData](https://green-api.com/v3/docs/api/groups/GetGroupData/) |
Expand Down Expand Up @@ -201,4 +200,4 @@ onEvent - ваша функция, которая должен содержат
Лицензировано на условиях [
Creative Commons Attribution-NoDerivatives 4.0 International (CC BY-ND 4.0)
](https://creativecommons.org/licenses/by-nd/4.0/).
[LICENSE](../LICENSE).
[LICENSE](../LICENSE).
15 changes: 15 additions & 0 deletions examples/qr.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from max_api_client_python import API

greenAPI = API.GreenAPI(
"3100000001", "d75b3a66374942c5b3c019c698abc2067e151558acbd412345"
)


def main():

response = greenAPI.account.qr()
print(response.data)


if __name__ == '__main__':
main()
17 changes: 17 additions & 0 deletions max_api_client_python/tools/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,19 @@ def logout(self) -> Response:
)
)

def qr(self) -> Response:
"""
The method is aimed for getting QR code.

https://green-api.com/en/docs/api/account/QR/
"""

return self.api.request(
"GET", (
"{{host}}/waInstance{{idInstance}}/qr/{{apiTokenInstance}}"
)
)

def setProfilePicture(self, path: str) -> Response:
"""
The method is aimed for setting an account picture.
Expand All @@ -113,6 +126,8 @@ def setProfilePicture(self, path: str) -> Response:

def startAuthorization(self, phoneNumber: int) -> Response:
"""
The method is deprecated. Please use QR.

The method is designed to receive SMS for instance authorization.

https://green-api.com/v3/docs/api/account/StartAuthorization/
Expand All @@ -130,6 +145,8 @@ def startAuthorization(self, phoneNumber: int) -> Response:

def sendAuthorizationCode(self, code: str) -> Response:
"""
The method is deprecated. Please use QR.

The method is designed to authorize an instance by SMS.

https://green-api.com/v3/docs/api/account/SendAuthorizationCode/
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name="max-api-client-python",
version="1.0.0",
version="1.0.1",
description=(
"This library helps you easily create"
" a Python application with MAX API."
Expand Down
1 change: 1 addition & 0 deletions tests/test_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def account_methods(self) -> typing.List[Response]:
api.account.getStateInstance(),
api.account.reboot(),
api.account.logout(),
api.account.qr(),
api.account.setProfilePicture(path)
]

Expand Down