mirror of
https://github.com/fergalmoran/emergelope.git
synced 2025-12-22 09:29:43 +00:00
Initial commit
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.idea
|
||||
52
app.py
Normal file
52
app.py
Normal file
@@ -0,0 +1,52 @@
|
||||
import os
|
||||
|
||||
from flask import Flask, jsonify
|
||||
from twilio.rest import Client
|
||||
|
||||
app = Flask(__name__)
|
||||
account_sid = os.environ['ACCOUNT_SID']
|
||||
auth_token = os.environ['AUTH_TOKEN']
|
||||
call_xml = os.environ['CALL_XML']
|
||||
to_numbers = os.environ['NUMBER_LIST']
|
||||
from_number = os.environ['FROM_NUMBER']
|
||||
|
||||
|
||||
@app.route('/debuggler')
|
||||
def debuggler():
|
||||
return jsonify(
|
||||
{
|
||||
'account_sid': account_sid,
|
||||
'auth_token': auth_token,
|
||||
'call_xml': call_xml,
|
||||
'to_numbers': to_numbers,
|
||||
'from_number': from_number
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@app.route('/')
|
||||
def catch_all():
|
||||
"""
|
||||
initiate cluster fuck!!
|
||||
"""
|
||||
|
||||
client = Client(account_sid, auth_token)
|
||||
sids = []
|
||||
for number in to_numbers.split(','):
|
||||
try:
|
||||
sids.append(
|
||||
client.calls.create(
|
||||
to=number,
|
||||
from_=from_number,
|
||||
url=call_xml,
|
||||
method='GET'
|
||||
)
|
||||
)
|
||||
except:
|
||||
print('Error sending message')
|
||||
|
||||
return sids
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(host='0.0.0.0', port=8081)
|
||||
4
emergency.xml
Normal file
4
emergency.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<Response>
|
||||
<Say voice="alice">Don't panic! Penny has pulled the emergency ripcord, please call Fergal!</Say>
|
||||
<Play>http://demo.twilio.com/docs/classic.mp3</Play>
|
||||
</Response>
|
||||
2
requirements.txt
Normal file
2
requirements.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
Flask
|
||||
twilio
|
||||
Reference in New Issue
Block a user