Skip to content

Repository files navigation

Onlinesim Python API

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

N|SolidPublish to PyPI

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

fromonlinesimruimportFreeNumbersService, RentNumbersService, ProxyService, UserService, NumbersServicedefmain():
client=UserService('YOUR_TOKEN')
balance=client.balance()
print(balance)
main()

Example2

fromonlinesimruimportFreeNumbersService, RentNumbersService, ProxyService, UserService, NumbersServicedefmain():
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 usingfromonlinesimruimportDriverdefmain():
driver=Driver('YOUR_TOKEN')
tzid=driver.numbers().get('service')
print(tzid)
code=driver.numbers().wait_code(tzid)
print(code)
main()

Example4 - Custom Domain

# Using custom domain for API endpointsfromonlinesimruimportDriverdefmain():
# Use custom domaindriver=Driver('YOUR_TOKEN', base_url='https://custom-onlinesim.com')
# Or use local development serverdriver_local=Driver('YOUR_TOKEN', base_url='http://localhost:8000')
# Standard usage remains the sametzid=driver.numbers().get('service')
print(tzid)
main()

Documentation

All documentation is in the wiki of this project - Documentation

Testing

The project includes comprehensive test coverage. All tests are located in the tests/ directory.

Running Tests

# Install test dependencies
pip install pytest pytest-cov pytest-mock
# Run all tests
python -m pytest tests/ -v
# Run specific test files
python -m pytest tests/test_basic_api.py -v
python -m pytest tests/integration_tests.py -v
# Run tests with coverage
python -m pytest tests/ --cov=onlinesimru --cov-report=html

For more detailed testing information, see tests/README.md.

Bugs

If you have any problems, please create Issues here

About

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

Topics

Resources

Stars

30 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages