Created
March 15, 2017 15:15
-
-
Save pyaf/7a52b5d6c7e1a92285a4c3b81addc683 to your computer and use it in GitHub Desktop.
Authy API functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.conf import settings | |
import requests | |
def send_verfication_code(user): | |
data = { | |
'api_key': settings.AUTHY_KEY, | |
'via': 'sms', | |
'country_code': user.country_code, | |
'phone_number': user.phone_number, | |
} | |
url = 'https://api.authy.com/protected/json/phones/verification/start' | |
response = requests.post(url,data=data) | |
return response | |
def verify_sent_code(one_time_password, user): | |
data= { | |
'api_key': settings.AUTHY_KEY, | |
'country_code': user.country_code, | |
'phone_number': user.phone_number, | |
'verification_code': one_time_password, | |
} | |
url = 'https://api.authy.com/protected/json/phones/verification/check' | |
response = requests.get(url,data=data) | |
return response |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment