From e4af28c4a398cd87378d3833b1d25db0f291ac9e Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Fri, 9 Oct 2026 11:35:11 +0500 Subject: upgrade to StrEnum --- vk/api.py | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) (limited to 'vk/api.py') diff --git a/vk/api.py b/vk/api.py index 8a55711..6b6cae1 100644 --- a/vk/api.py +++ b/vk/api.py @@ -4,7 +4,7 @@ # Distributed under the MIT License. from collections.abc import Iterable, Mapping -from enum import Enum +from enum import auto, StrEnum import json from urllib.error import URLError import urllib.parse @@ -69,39 +69,27 @@ def _join_path(base, url): ACCESS_TOKEN = "3d242bac3d242bac3d242bacd03e66eae033d243d242bac5755894cf6163d769859232d" -class Version(Enum): +class Version(StrEnum): # https://dev.vk.com/en/reference/versions V5_199 = "5.199" DEFAULT = V5_199 - def __str__(self): - return self.value - -class Language(Enum): - EN = "en" +class Language(StrEnum): + EN = auto() DEFAULT = EN - def __str__(self): - return self.value - -class Method(Enum): +class Method(StrEnum): USERS_GET = "users.get" FRIENDS_GET = "friends.get" - def __str__(self): - return self.value - -class CommonParameters(Enum): +class CommonParameters(StrEnum): ACCESS_TOKEN = "access_token" VERSION = "v" LANGUAGE = "lang" - def __str__(self): - return self.value - class API: _ROOT_URL = "https://api.vk.com/method/" -- cgit v1.3