Compare commits

...

4 Commits

Author SHA1 Message Date
anons-voip e51fd5f591 changed default site 2024-06-10 21:35:48 -04:00
anons-voip 9f800b4f99 added information about what the server serves 2024-06-10 21:35:24 -04:00
anons-voip f794d5de2c updating to use waitress 2024-06-10 21:25:52 -04:00
anons-voip e71a8101e9 final format change 2024-06-10 21:20:57 -04:00
3 changed files with 40 additions and 4 deletions

View File

@ -30,10 +30,39 @@ Python flask app that uses voip.ms to manage a number of DID numbers for SMS. Ca
The config used in this project uses the JSON format and expects a `username` and `password`
Ex:
Ex:
```
{
"username":"voipms-email",
"password":"voipms-api-password"
}
```
```
## Endpoints
### /numbers
*Returns a list of numbers in use*
Supports: GET
Returns a list of javascript objects with keys: did (int as string), sms_available (boolean as int), mms_available (boolean as int)
### /sms
*Returns sms/mms messages for a given number*
Supports: GET,POST
Expects: string `did`
Returns a list of javascript objects with keys: message (string), did (int as string), contact (string as int), date (date as string), media (list)
### /enablesms
*[DISABLED] Enables sms feature for a given number*
Supports: GET,POST
Expects: string `did`
Returns a boolean as int

10
app/server.py 100644 → 100755
View File

@ -1,3 +1,4 @@
#!/usr/bin/env python3
from flask import Flask, request, abort
from voipms.api import Client
import did, sms
@ -10,8 +11,8 @@ client = Client(conf["username"],conf["password"])
@app.route("/", methods=['GET'])
def hello_world():
return "<p>Hello, World!</p>"
def default():
return '<a href="http://git.community.i2p/anons-voip/voipsms">Check out the project</a>'
@app.route("/numbers", methods=['GET'])
def get_numbers():
@ -28,3 +29,8 @@ def set_sms():
abort(403)
did = request.args.get('did')
return sms.get_sms(client, did)
if __name__ == "__main__":
from waitress import serve
serve(app, host="0.0.0.0", port=8080)

View File

@ -1,3 +1,4 @@
voipms-python
flask
waitress
requests