Commit 9f62f8fb authored by Yoann Ono Dit Biot's avatar Yoann Ono Dit Biot Committed by kaiyou
Browse files

Remove sender from OVH function

Add options to avoid SMS pending
parent 886c9044
import ovh
from twilio.rest import Client
from amonit import util
def twilio_sms(context, sid, token, sender, message, dest):
rendered = util.render(message, context)
client = Client(sid, token)
for phone in dest:
client.messages.create(body=rendered, from_=sender, to=dest)
def ovh_sms(context, application_key, application_secret,
consumer_key, service, message, dest):
rendered = util.render(message, context)
client = ovh.Client('ovh-eu', application_key,
application_secret, consumer_key)
endpoint = '/sms/%s/jobs' % service
client.post(endpoint,
noStopClause=True,
senderForResponse=True,
priority='high',
message=rendered,
receivers=dest)
......@@ -21,9 +21,11 @@ lxml==4.4.1
MarkupSafe==1.1.1
matrix-client==0.3.2
more-itertools==7.2.0
ovh==0.5.0
parse==1.12.1
pycparser==2.19
pyee==6.0.0
PyJWT==1.7.1
pyppeteer==0.0.25
pyquery==1.4.0
python-dateutil==2.8.0
......@@ -36,6 +38,7 @@ six==1.12.0
soupsieve==1.9.3
text-unidecode==1.3
tqdm==4.36.1
twilio==6.38.1
urllib3==1.25.5
vine==1.3.0
w3lib==1.21.0
......
......@@ -10,3 +10,5 @@ redis
requests
requests-html
faker
twilio
ovh
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment