Skip to main content

vkmax

Python user client for VK MAX messenger (OneMe)

What is VK MAX?

MAX (internal code name OneMe) is another project by the Russian government in an attempt to create a unified domestic messaging platform with features such as login via the government services account (Gosuslugi/ESIA).
It is developed by VK Group.

What is vkmax?

This is a client library for MAX, allowing to create userbots and custom clients.
An example of a simple userbot that retrieves weather can be found at examples/weather-userbot.

Installation

The package is available on PyPI
pip install vkmax

Usage

More in examples

import asyncio
import logging

import requests
import sys

from vkmax.client import MaxClient
from vkmax.functions.messages import edit_message

from pathlib import Path


async def get_weather(city: str) -> str:
    response = requests.get(f"https://ru.wttr.in/{city}?Q&T&format=3")
    return response.text


async def packet_callback(client: MaxClient, packet: dict):
    if packet['opcode'] == 128:
        message_text: str = packet['payload']['message']['text']
        if message_text not in ['.info', '.weather']:
            return

        if message_text == ".info":
            text = "Userbot connected"

        elif ".weather" in message_text:
            city = message_text.split()[1]
            text = await get_weather(city)

        await edit_message(
            client,
            packet["payload"]["chatId"],
            packet["payload"]["message"]["id"],
            text
        )


async def main():
    client = MaxClient()

    await client.connect()

    login_token_file = Path('login_token.txt')

    if login_token_file.exists():
        login_token_from_file = login_token_file.read_text(encoding='utf-8').strip()
        try:
            await client.login_by_token(login_token_from_file)
        except:
            print("Couldn't login by token. Falling back to SMS login")

    else:
        phone_number = input('Enter your phone number: ')
        sms_login_token = await client.send_code(phone_number)
        sms_code = int(input('Enter SMS code: '))
        account_data = await client.sign_in(sms_login_token, sms_code)

        login_token = account_data['payload']['tokenAttrs']['LOGIN']['token']
        login_token_file.write_text(login_token, encoding='utf-8')

    await client.set_callback(packet_callback)

    await asyncio.Future()  # run forever


if __name__ == "__main__":
    asyncio.run(main())

Metadata

Release files for vkmax 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vkmax 1.0.2
File Size Uploaded Provenance Actions
vkmax-1.0.2.tar.gz 8.8 kB Without provenance Details for vkmax-1.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for vkmax 1.0.2
File Interpreter ABI Platform Actions
vkmax-1.0.2-py3-none-any.whl Python 3 none any Details for vkmax-1.0.2-py3-none-any.whl

Total release size: 18.3 kB

Release files / vkmax-1.0.2.tar.gz

Download URL vkmax-1.0.2.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a7d23be4d39b187bb9671d2d1d61061d9ca25ec5a37c7dd8129f262b6ad07e3e
BLAKE2b-256 checksum
How to use checksums
e925ef4d816a0e148e3c81bb4081cea6c03a5f95cd34e57e0fc560aad43e95be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release files / vkmax-1.0.2-py3-none-any.whl

Download URL vkmax-1.0.2-py3-none-any.whl
Size 9.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fd4783d4f192c035168920b6e2705176afe59c41830c8c90dd7448ad25378462
BLAKE2b-256 checksum
How to use checksums
24032368e62e89c48c959ed62d96d658d7ab311b8f0966a7fc5aa4cb6e373ff8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Security for vkmax 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page