#api-request #requests #second #per #low-level #client #client-config

vk_executive

Relatively low-level VK API library designed for millions requests per second

7 releases

0.8.5 Feb 28, 2023
0.8.4 Feb 28, 2023
0.7.0 Feb 3, 2023

#324 in HTTP client

MIT license

32KB
639 lines

VK Executive 🚀

Library for fast data collection from VK

[dependencies]
vk_executive = "0.8"

Example

use vk_executive::{Client, Instance};
use vk_method::{Method, Params};

#[tokio::main]
async fn main() {
    let token = ["1234567890abcdef1234567890abcdef1234567890abcdef"];
    let instances = Instance::from_tokens(token).unwrap();

    let pool = Client::from_instances(instances);

    let mut params = Params::new();
    params.insert("user_id", 1);

    let response = pool.method(Method::new(
        "users.get",
        params,
    )).await.unwrap();

    assert_eq!(
        response,
        serde_json::json!([
            {
                "id": 1,
                "first_name": "Pavel",
                "last_name": "Durov",
                "is_closed": false,
                "can_access_closed": true
            }
        ])
    )
}

lib.rs:

Implementation of Vkontakte Client. General purpose is perform as much as possible requests per second. It uses smart compression vk_method::Methods into execute. Also you can create client which uses multiple Configs with Client::from_configs. Each Config includes own token, http client, api version and so on.

By default, it provides relatively low-level Client::method However, there is thisvk feature avaible. Consider using it if you want call vk methods directly from Client. For details see thisvk.

Dependencies

~8–21MB
~311K SLoC