Skip to main content

Async VakSms api wrapper for python

Project description

VAKSMS API for Python 3

About

This library is a wrapper for the https://vak-sms.com/api/vak/ API from enthusiasts. All methods are described and all types are explicitly defined. Methods that create requests to https://vak-sms.com/api/vak/ return a pydantic's models for each response. Please write about all problems related to the library to issues

API is up-to-date as of 22 May 2025.

Features

  • It's completely asynchronous
  • You can use multiple clients to work with multiple users or shops
  • All methods for working with API are implemented
  • The library returns strictly typed for responses from APIs
  • For each method, docstrings are used
  • The library handle {type: error} responses and throws VaksmsBadRequest exception
  • Modern, strict code for Python 3.10+

Library Installation

  • Install via pip: pip install aiovaksms
  • Download sources - git clone https://github.com/AioSmsProviders/aiovaksms

Getting Started

first steps (new in 3.0 update)

import asyncio

from aiovaksms import Vaksms


async def main():
    client = Vaksms('TOKEN') # use vaksms.com domain (not work in russia)
    client = Vaksms('TOKEN', base_url='https://moresms.net') # work in russia

    number = await client.get_number('ya')
    print(number.tel)  # 79995554433

    # recieve smscode
    sms_code = await number.wait_sms_code(timeout=300, per_attempt=5) # do not indicate timeout and per_attempt
    print(sms_code) #1234

    # set status
    await number.set_status('end')
    # bad - ban number
    # end - cancel number
    # send - new sms


asyncio.run(main())

Get user balance

import asyncio

from aiovaksms import Vaksms


async def main():
    client = Vaksms('TOKEN') # use vaksms.com domain (not work in russia)
    client = Vaksms('TOKEN', base_url='https://moresms.net') # work in russia
    balances = await client.get_balance()
    print(balances)  # balance = 100.0


asyncio.run(main())

Get number count

import asyncio

from aiovaksms import Vaksms

async def main():
    client = Vaksms('TOKEN') # use vaksms.com domain (not work in russia)
    client = Vaksms('TOKEN', base_url='https://moresms.net') # work in russia
    
    data = await client.get_count_number('cp')
    print(data)  # service='cp' count=4663 price=18.0


asyncio.run(main())

Get country list

import asyncio

from aiovaksms import Vaksms


async def main():
    client = Vaksms('TOKEN') # use vaksms.com domain (not work in russia)
    client = Vaksms('TOKEN', base_url='https://moresms.net') # work in russia
    data = await client.get_country_list()
    print(data)  # [CountryOperator(countryName='Tajikistan', countryCode='tj', operatorList=['babilon mobile', 'beeline', 'megafon', 'tcell']), CountryOperator(countryName='Zimbabwe', countryCode='zw', operatorList=['econet', 'netone', 'telecel'])... ]


asyncio.run(main())

Get number

import asyncio

from aiovaksms import Vaksms


async def main():
    client = Vaksms('TOKEN') # use vaksms.com domain (not work in russia)
    client = Vaksms('TOKEN', base_url='https://moresms.net') # work in russia
    data = await client.get_number('ya')
    
    # An exclusive function for obtaining the lifetime of a number
    # all known services whose lifetime differs from the standard 20 minutes
    # are included in the library database as of 10/02/2024
    # also work with "rent=True" parameter
    print(data.lifetime) # 1200 lifetime from date of purchase
    print(data.lives_up_to) # 1727823949 unix time of death
    
    print(data)  # tel=79296068469 service='ya' idNum='1725546315697382' lifetime=1200 lives_up_to=1727823949


asyncio.run(main())

Recieve smscode

import asyncio

from aiovaksms import Vaksms


async def main():
    client = Vaksms('TOKEN')  # use vaksms.com domain (not work in russia)
    client = Vaksms('TOKEN', base_url='https://moresms.net')  # work in russia
    data = await client.get_sms_code('1725546315697382') # 1725546315697382 is number id (idNum)
    print(data)  # smsCode='1234'


asyncio.run(main())

request a new sms

import asyncio

from aiovaksms import Vaksms


async def main():
    client = Vaksms('TOKEN') # use vaksms.com domain (not work in russia)
    client = Vaksms('TOKEN', base_url='https://moresms.net') # work in russia
    data = await client.set_status('1725546315697382', 'send') # 1725546315697382 is number id (idNum)
    print(data)  # ready


asyncio.run(main())

get service full name, service info, service icons

this method not in official vaksms documentation

import asyncio

from aiovaksms import Vaksms


async def main():
    client = Vaksms('TOKEN') # use vaksms.com domain (not work in russia)
    client = Vaksms('TOKEN', base_url='https://moresms.net') # work in russia
    data = await client.get_count_number_list()
    print(data)  # {'mr': Service(name='VK - MailRu', icon='https://vak-sms.com/static/service/mr.png', info='Тут можно принять смс от сервисов VKGroup.Не забывайте проверять номера на занятость через восстановление. Подробнее в базе знаний - https://bit.ly/3M6tXup', cost=22.0, rent=False, quantity=41153, private=False), ... }
    print(data['mr'].name) # VK - MailRu
    

asyncio.run(main())

Contact

License

Released under GPL by @lolkofka.

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

aiovaksms-3.0.1.tar.gz (33.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aiovaksms-3.0.1-py3-none-any.whl (34.1 kB view details)

Uploaded Python 3

File details

Details for the file aiovaksms-3.0.1.tar.gz.

File metadata

  • Download URL: aiovaksms-3.0.1.tar.gz
  • Upload date:
  • Size: 33.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for aiovaksms-3.0.1.tar.gz
Algorithm Hash digest
SHA256 3501535919a99857f454ff4ebcdf9c44c16aff837d866badb8b4525a92bf2af2
MD5 0142f68a955d25cdef4d4e6c822858d9
BLAKE2b-256 d96407c1e8d09a91686c4ce241bf6adbfe03902c4047eb758205762f05345a6a

See more details on using hashes here.

File details

Details for the file aiovaksms-3.0.1-py3-none-any.whl.

File metadata

  • Download URL: aiovaksms-3.0.1-py3-none-any.whl
  • Upload date:
  • Size: 34.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for aiovaksms-3.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 11fe912d9bc20bcd423cc9b5261d2b6327c057c2432fc6318a4a17c35d8473dd
MD5 8673849522a34e6e23a50717cd935850
BLAKE2b-256 422c601a95e919d3bce64e3fb3576e60c8b32ba4aa08e8a8a838402b682744d3

See more details on using hashes here.

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