Skip to main content

An API wrapper for Max.

Project description

Max API Interface

The Max API Interface allows you to interact with the Max Messenger WebSocket API for sending messages, retrieving histories, and subscribing to real-time events.

Getting Started

Prerequisites

  • Python 3.x

Installing

To install this library, run the following command in your terminal:

pip install MaxBridge

Obtaining the Authentication Token

To interact with the Max API, you'll need to authenticate and obtain a long-lived authentication token (from a legitimate web session). Follow these steps:

  1. Open your web browser and navigate to Max Messenger Web Version.

  2. Log in to your Max account if you haven't done so already.

  3. After logging in, open the Developer Tools in your web browser (right-click anywhere on the page and select "Inspect" or press F12).

  4. Go to the "Application" tab in Developer Tools.

  5. Find and click on "Local storage" in the left sidebar under the "Storage" section. Look for the cookies belonging to the https://web.max.ru domain.

  6. Find the authentication token. This token is a value of __oneme_auth.

  7. Copy the value of the authentication token. You'll use this value to authenticate your requests in the MaxAPI class.

Using the Max API Interface

Initializing the MaxAPI class

To create an instance of the MaxAPI, pass the authentication token obtained from the previous step:

from MaxBridge import MaxAPI

auth_token = 'YOUR_AUTH_TOKEN_HERE'
api = MaxAPI(auth_token)

Available Methods

  1. Sending a Message:

    To send a message, use:

    api.send_message(chat_id=12345678, text="Hello, World!")
    
  2. Retrieving Message History:

    To retrieve message history, use:

    response = api.get_history(chat_id=12345678, count=20)
    
  3. Subscribing to a Chat:

    To subscribe to real-time events from a chat, use:

    api.subscribe_to_chat(chat_id=12345678, subscribe=True)
    
  4. Marking Messages as Read:

    To mark a specific message as read, use:

    api.mark_as_read(chat_id=12345678, message_id="12345678")
    
  5. Getting video or file

    To get video, use:

    api.get_video(id=12345678)
    

    To get file, use:

    api.get_file(id=12345678, chat_id=12345678, msg_id="12345678")
    

The chat ID is required for most operations. You can obtain it from the chat URL or through other means specific to your application.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

maxbridge-1.3.2.tar.gz (8.6 kB view details)

Uploaded Source

File details

Details for the file maxbridge-1.3.2.tar.gz.

File metadata

  • Download URL: maxbridge-1.3.2.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for maxbridge-1.3.2.tar.gz
Algorithm Hash digest
SHA256 f0f2acf577f1362e868b57ca5af6dc860bc2a2216cb6dd76f6e628462c8cb879
MD5 33af93d4d642eb57daf7566d60613ba7
BLAKE2b-256 888f57bc724fd49e79cebba08ec9b3f54c68a09d6425c4c6414b43dd20b3909c

See more details on using hashes here.

Provenance

The following attestation bundles were made for maxbridge-1.3.2.tar.gz:

Publisher: python-publish.yml on Sharkow1743/MaxAPI

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page