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 enthusiast. 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 05 September 2024.

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.7

Library Installation

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

Getting Started

Get user balance

import asyncio

from aiovaksms import VakSms


async def main():
    client = VakSms('TOKEN')
    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')
    
    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')
    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')
    data = await client.get_number('ya')
    print(data)  # tel=79296068469 service='ya' idNum='1725546315697382'


asyncio.run(main())

Recieve smscode

import asyncio

from aiovaksms import VakSms


async def main():
    client = VakSms('TOKEN')
    data = await client.get_smscode('1725546315697382')
    print(data)  # smsCode='1234'


asyncio.run(main())

request a new sms

import asyncio

from aiovaksms import VakSms


async def main():
    client = VakSms('TOKEN')
    data = await client.set_status('1725546315697382', 'send')
    print(data)  # ready


asyncio.run(main())

Contact

License

Released under MIT 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-1.0.1.tar.gz (44.0 kB view hashes)

Uploaded Source

Built Distribution

aiovaksms-1.0.1-py3-none-any.whl (32.3 kB view hashes)

Uploaded Python 3

Supported by

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