File tree Expand file tree Collapse file tree 7 files changed +27
-68
lines changed Expand file tree Collapse file tree 7 files changed +27
-68
lines changed Original file line number Diff line number Diff line change 1515client = vonage .Client (key = VONAGE_API_KEY , secret = VONAGE_API_SECRET )
1616
1717insight_json = client .number_insight .get_advanced_number_insight (number = INSIGHT_NUMBER )
18- pprint (insight_json )
18+ pprint (insight_json )
Original file line number Diff line number Diff line change 1010VONAGE_API_SECRET = os .getenv ('VONAGE_API_SECRET' )
1111INSIGHT_NUMBER = os .getenv ('INSIGHT_NUMBER' )
1212
13- import vonage
13+ from vonage import Auth , Vonage
14+ from vonage_number_insight import BasicInsightRequest , BasicInsightResponse
1415
15- client = vonage . Client ( key = VONAGE_API_KEY , secret = VONAGE_API_SECRET )
16+ client = Vonage ( Auth ( api_key = VONAGE_API_KEY , api_secret = VONAGE_API_SECRET ) )
1617
17- insight_json = client .number_insight .get_basic_number_insight (number = INSIGHT_NUMBER )
18- pprint (insight_json )
18+ insight : BasicInsightResponse = client .number_insight .basic_number_insight (
19+ BasicInsightRequest (number = INSIGHT_NUMBER )
20+ )
21+ pprint (insight )
Original file line number Diff line number Diff line change 1010VONAGE_API_SECRET = os .getenv ('VONAGE_API_SECRET' )
1111INSIGHT_NUMBER = os .getenv ('INSIGHT_NUMBER' )
1212
13- import vonage
13+ from vonage import Auth , Vonage
14+ from vonage_number_insight import StandardInsightRequest , StandardInsightResponse
1415
15- client = vonage . Client ( key = VONAGE_API_KEY , secret = VONAGE_API_SECRET )
16+ client = Vonage ( Auth ( api_key = VONAGE_API_KEY , api_secret = VONAGE_API_SECRET ) )
1617
17- insight_json = client .number_insight .get_standard_number_insight (number = INSIGHT_NUMBER )
18- pprint (insight_json )
18+ insight : StandardInsightResponse = client .number_insight .standard_number_insight (
19+ StandardInsightRequest (number = INSIGHT_NUMBER )
20+ )
21+ pprint (insight )
Original file line number Diff line number Diff line change 1- import os
2- from os .path import join , dirname
3-
4- from dotenv import load_dotenv
5-
6- # Load the environment
7- envpath = join (dirname (__file__ ), '../.env' )
8- load_dotenv (envpath )
9-
10- VONAGE_API_KEY = os .getenv ("VONAGE_API_KEY" )
11- VONAGE_SIGNATURE_SECRET = os .getenv ("VONAGE_SIGNATURE_SECRET" )
12- VONAGE_SIGNATURE_SECRET_METHOD = os .getenv ("VONAGE_SIGNATURE_SECRET_METHOD" )
13-
141from fastapi import FastAPI , Request
15- from vonage import Auth , Vonage
16-
17- client = Vonage (
18- Auth (
19- api_key = VONAGE_API_KEY ,
20- signature_secret = VONAGE_SIGNATURE_SECRET ,
21- signature_method = VONAGE_SIGNATURE_SECRET_METHOD ,
22- )
23- )
2+ from pprint import pprint
243
254app = FastAPI ()
265
276
287@app .get ('/delivery-receipt' )
298async def get_delivery_receipt (request : Request ):
309 data = await request .json ()
31-
32- if client .http_client .auth .check_signature (data ):
33- print ('Valid signature' )
34- else :
35- print ('Invalid signature' )
10+ pprint (data )
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ from pprint import pprint
2+ from fastapi import FastAPI , Request
3+
4+ app = FastAPI ()
5+
6+
7+ @app .post ('/inbound' )
8+ async def inbound_message (request : Request ):
9+ data = await request .json ()
10+ pprint (data )
You can’t perform that action at this time.
0 commit comments