def verify(client, dummy_data):
    import vonage

    return vonage.Verify(client)
Example #2
0
import os
import os
from os.path import join, dirname
from dotenv import load_dotenv
import vonage

dotenv_path = join(dirname(__file__), "../.env")
load_dotenv(dotenv_path)

VONAGE_API_KEY = os.getenv("VONAGE_API_KEY")
VONAGE_API_SECRET = os.getenv("VONAGE_API_SECRET")
RECIPIENT_NUMBER = os.getenv("RECIPIENT_NUMBER")
BRAND_NAME = os.getenv("BRAND_NAME")
WORKFLOW_ID = os.getenv("WORKFLOW_ID")

client = vonage.Client(key=VONAGE_API_KEY, secret=VONAGE_API_SECRET)
verify = vonage.Verify(client)

response = verify.start_verification(number=RECIPIENT_NUMBER,
                                     brand=BRAND_NAME,
                                     workflow_id=WORKFLOW_ID)

if response["status"] == "0":
    print("Started verification request_id is %s" % (response["request_id"]))
else:
    print("Error: %s" % response["error_text"])
Example #3
0
import argparse
import os
from os.path import join, dirname
from dotenv import load_dotenv
import vonage

dotenv_path = join(dirname(__file__), "../.env")
load_dotenv(dotenv_path)

VONAGE_API_KEY = os.getenv("VONAGE_API_KEY")
VONAGE_API_SECRET = os.getenv("VONAGE_API_SECRET")

argument_parser = argparse.ArgumentParser()
argument_parser.add_argument("request_id")
argument_parser.add_argument("verification_code")
arguments = argument_parser.parse_args()

REQUEST_ID = arguments.request_id
CODE = arguments.verification_code

verify = vonage.Verify(key=VONAGE_API_KEY, secret=VONAGE_API_SECRET)

response = verify.check(REQUEST_ID, code=CODE)

if response["status"] == "0":
    print("Verification successful, event_id is %s" % (response["event_id"]))
else:
    print("Error: %s" % response["error_text"])
Example #4
0
 def verify(self):
     ctx = _app_ctx_stack.top
     if ctx is not None:
         if not hasattr(ctx, 'vonage_verify'):
             ctx.vonage_verify = vonage.Verify(self.client)
         return ctx.vonage_verify
Example #5
0
def verify(client):
    import vonage

    return vonage.Verify(client)