Git Product home page Git Product logo

onlinesim-python-api's Introduction

Onlinesim Python API

Wrapper for automatic reception of SMS-messages by onlinesim.ru

N|Solid Python publish

Installation

You can install or upgrade package with:

$ pip install onlinesimru --upgrade

Or you can install from source with:

$ git clone https://github.com/s00d/onlinesim-python-api
$ cd onlinesim-python-api
$ python setup.py install

...or install from source buth with pip

$ pip install git+https://github.com/s00d/onlinesim-python-api

Example

from onlinesimru import FreeNumbersService, RentNumbersService, ProxyService, UserService, NumbersService


def main():
    client = UserService('YOUR_TOKEN')
    balance = client.balance()
    print(balance)


main()

Example2

from onlinesimru import FreeNumbersService, RentNumbersService, ProxyService, UserService, NumbersService


def main():
    numbers = NumbersService('YOUR_TOKEN')
    input('Press enter if you sms was sent')

    tzid = numbers.get('service')
    print(tzid)
    code = numbers.wait_code(tzid)
    print(code)


main()

Example3

# multiple driver using
from onlinesimru import Driver


def main():
    driver = Driver('YOUR_TOKEN')

    tzid = driver.numbers().get('service')
    print(tzid)
    code = driver.numbers().wait_code(tzid)
    print(code)


main()

Documentation

All documentation is in the wiki of this project - Documentation

Bugs

If you have any problems, please create Issues here

onlinesim-python-api's People

Contributors

ironbat1 avatar ligix avatar rthell avatar s00d avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

onlinesim-python-api's Issues

GetNumbers.py , close function.

Good day!

Can you implement parameter "ban" for function close?

   GetNumbers.py  line 29
    def close(self, tzid: int):
        return self._get(f'/setOperationOk', {'tzid': tzid})

According documentation you can ban number after 5 min waiting.

Thanks!

Issue for Telegram code request.

In the example to get the code, you specified the following:

multiple driver using

from onlinesimru import Driver

def main():
driver = Driver('YOUR_TOKEN')

tzid = driver.numbers().get('service')
print(tzid)
code = driver.numbers().wait_code(tzid)
print(code)

main()
When receiving SMS from Telegram, this method displays ID messages.
[13464390577]where full SMS is[16042601337] Telegram code 98454
I propose to add an example to receive SMS from a telegram.
from onlinesimru import Driver
def main():
driver = Driver('YOUR_TOKEN')
tzid = driver.numbers().get('service')
print(tzid)
code = driver.numbers().wait_code(tzid=tzid, full_message=True)
code = code.split('Telegram code ')
print(code[1])
main()

Thanks

Some Questions / Errors

Hello, thank you for api. I have several questions about how it works ;)

code = driver.numbers().wait_code(tzid=tzid, timeout=60*3)

if sms-message did not received and timeout was expired will raised unexpected error:

File GetNumbers.py line 53. 
 if response['code'] and not not_end and response['code'] != __last_code:
KeyError: 'code'

And can you raise custom exception instead of Exception, because it's hard to resolve it?

File GetNumbers line 49:

   while True:
            time.sleep(timeout)
            counter += 1
            if counter >= 10:
                raise ('Timeout error')                          <-----THIS
            response = self.stateOne(tzid, 1, False)


So through web you can ban bad number after some time.

How can i do it using api?

Thanks!

How do i use it

Ok, i just want to know how i buy a number and then get the code out of it?
The params i need are: the number, the code
Sry if this is a dumb quest ;:D .-.
Thanks in advance

Async support?

Hi, in the beginning your lib have async features, but you remove it, can i to know why?

Problem in installing onlinesim package

I Installed the package and i got this error

image

image

i think it's not installed perfectly

i used this cmd for the installation

$ pip install onlinesimru --upgrade

help me

can u help me to setup on my cpanel and doamin i cannt setup it

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.