From 477573759a9c8459f7483fca04b92ee5eadbbae2 Mon Sep 17 00:00:00 2001 From: Anna Date: Tue, 23 Dec 2025 09:19:48 +0300 Subject: [PATCH 1/2] SDK-43 --- README.md | 1 + examples/qr.py | 15 +++++++++++++++ max_api_client_python/tools/account.py | 17 +++++++++++++++++ setup.py | 2 +- tests/test_methods.py | 1 + 5 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 examples/qr.py diff --git a/README.md b/README.md index f94ec67..f8b4f9e 100644 --- a/README.md +++ b/README.md @@ -151,6 +151,7 @@ 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/) | diff --git a/examples/qr.py b/examples/qr.py new file mode 100644 index 0000000..c00c08a --- /dev/null +++ b/examples/qr.py @@ -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() diff --git a/max_api_client_python/tools/account.py b/max_api_client_python/tools/account.py index 175ddfd..141b238 100644 --- a/max_api_client_python/tools/account.py +++ b/max_api_client_python/tools/account.py @@ -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. @@ -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/ @@ -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/ diff --git a/setup.py b/setup.py index 29836fc..669c448 100644 --- a/setup.py +++ b/setup.py @@ -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." diff --git a/tests/test_methods.py b/tests/test_methods.py index 148f066..2b9c593 100644 --- a/tests/test_methods.py +++ b/tests/test_methods.py @@ -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) ] From 144e663c4b14e27e243fb9fe264c37218f3bc8c0 Mon Sep 17 00:00:00 2001 From: Ash <165753515+AshLeigh-Fraxinus@users.noreply.github.com> Date: Tue, 23 Dec 2025 09:56:02 +0300 Subject: [PATCH 2/2] Update README to remove authorization methods Removed methods for starting authorization and sending authorization code from the documentation. --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index f8b4f9e..37f601d 100644 --- a/README.md +++ b/README.md @@ -153,8 +153,6 @@ onEvent - ваша функция, которая должен содержат | `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/) | @@ -202,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). \ No newline at end of file +[LICENSE](../LICENSE).