RestSMSGateway 💌
Unofficial Library
REST SMS Gateway allows to change your phone into a powerful SMS Gateway which you can control from a computer.
Getting Started
Note: The computer (that will run the script) and your phone have to be connected on the same network. Android only!
First of all, you have to install Rest SMS Gateway on your Android phone.
Open the app and press the start button. You'll need the IP address shown in there (e.g, http://172.16.19.77:8080).
Installing
Easy-peasy! You only need to run one command
pip install rest-sms-gateway
Running the tests
Note: My mistake!
We don't have test yet.
Examples
Import and configure the client:
>>> from rest_sms_gateway import SMSGatewayClient
>>> client = SMSGatewayClient('http://172.16.19.77:8080')
Now, you can do what you want (or almost)!
Let's list all conversations available in the mobile phone:
>>> client.get_thread()
#OUTPUT
# {'threads': [{'timestamps': {'update': '1544785173349'}, '_id': '95'},
# {'timestamps': {'update': '1544751618760'}, '_id': '94'},
# {'timestamps': {'update': '1544751384521'}, '_id': '93'},
# {'timestamps': {'update': '1544115829308'}, '_id': '92'},
# {'timestamps': {'update': '1543572583029'}, '_id': '91'},
# {'timestamps': {'update': '1543275852269'}, '_id': '90'},
# {'timestamps': {'update': '1544204987635'}, '_id': '89'},
# {'timestamps': {'update': '1541087704128'}, '_id': '88'},
# {'timestamps': {'update': '1540053558537'}, '_id': '87'},
# {'timestamps': {'update': '1539808989397'}, '_id': '86'}],
# 'size': 10,
# 'limit': '10',
# 'offset': '0'}
>>> client.get_thread(limit=2)
#OUTPUT
# {'threads': [{'timestamps': {'update': '1544785173349'}, '_id': '95'},
# {'timestamps': {'update': '1544751618760'}, '_id': '94'}],
# 'size': 2,
# 'limit': '2',
# 'offset': '0'}
And now, send a message!
>>> sender = client.send_sms('+5511987654321', 'Your first message') # Single SMS
>>> if sender['ok']: # or sender['status_code'] == 200
... print('Message sent!')
# OR
>>> friends_numbers = ['+5511987654321', '+5511987654322', '+5511987654323']
>>> for friend in friends_numbers: # Bulk SMS
... client.send_sms(friend, "Hey, let's play BroForce!")
Attention
If you're trying to send lot of messages at once, read this article about "Messaging is sending a large amount of messages".
In my tests, this notification only appears after sending 30 messages. An alternative way out for this is:
>>> from rest_sms_gateway import SMSGatewayClient
>>> import time
>>> client = SMSGatewayClient('http://172.16.19.77:8080')
>>> for msg_number in range(60):
... client.send_sms('+5511987654321', 'Your msg here!')
... if (msg_number+1) % 30 == 0:
... # Every 30 messages, an interval of 30 seconds is given
... time.sleep(30)
... else:
... # An interval of 1.5 seconds is given for each message
... time.sleep(1.5)
Also be careful with your phone carrier, they may be slow with the high demand for messages and/or send the messages out of order.
Authors
- Geraldo Castro - Just for fun! - exageraldo
See also the list of contributors who participated in this project.
License
This project is licensed under the GNU Lesser General Public License v3 (LGPLv3) - see the LICENSE file for details
Acknowledgments
- Python Community
- Tyrone Damasceno for trying the code and finding bugs
- Sedir Morais for reviewing the code and finding errors.
Metadata
Release files for rest-sms-gateway 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rest_sms_gateway-0.5.0.tar.gz | 19.0 kB | Without provenance | Details for rest_sms_gateway-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rest_sms_gateway-0.5.0-py3-none-any.whl | Python 3 | none | any | Details for rest_sms_gateway-0.5.0-py3-none-any.whl |
Total release size: 38.5 kB
Release files / rest_sms_gateway-0.5.0.tar.gz
| Download URL | rest_sms_gateway-0.5.0.tar.gz |
|---|---|
| Size | 19.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
37f07c6789493215fdd8928c543a3e5ed3b2e9c8603f730d1fa640726fcf7628
|
|
BLAKE2b-256 checksum How to use checksums |
700e52330e094f3fe5a89533d0fda08762a87862be3453a80be5038e8156b085
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8
|
Release files / rest_sms_gateway-0.5.0-py3-none-any.whl
| Download URL | rest_sms_gateway-0.5.0-py3-none-any.whl |
|---|---|
| Size | 19.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a4d2a64930e0bf63755372399e5b51cc0e5ea1f0c5ed40e24e5f0ff016410906
|
|
BLAKE2b-256 checksum How to use checksums |
0aed9f59e7125c733b8e9c52924897bf5d369ca23cd08b1aa88d54f715156a39
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8
|
Security for rest-sms-gateway 0.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.