Skip to content

Commit 8b16f55

Browse files
author
Mark Lewin
authored
Add basic, standard and advanced (sync) building blocks (#29)
* Add basic, standard and advanced (sync) building blocks * Standardize placeholder names across building blocks
1 parent 91a9565 commit 8b16f55

File tree

4 files changed

+57
-0
lines changed

4 files changed

+57
-0
lines changed

example.env

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@ NEXMO_API_KEY='YOUR_API_KEY'
22
NEXMO_API_SECRET='YOUR_API_SECRET'
33
TO_NUMBER='EXAMPLE_TO_NUMBER'
44
FROM_NUMBER='EXAMPLE_FROM_NUMBER'
5+
6+
# Number Insight examples
7+
INSIGHT_NUMBER='NUMBER_FOR_INSIGHT'

number-insight/ni-advanced.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import os
2+
from os.path import join, dirname
3+
from pprint import pprint
4+
from dotenv import load_dotenv
5+
6+
dotenv_path = join(dirname(__file__), '../.env')
7+
load_dotenv(dotenv_path)
8+
9+
NEXMO_API_KEY = os.getenv('NEXMO_API_KEY')
10+
NEXMO_API_SECRET = os.getenv('NEXMO_API_SECRET')
11+
INSIGHT_NUMBER = os.getenv('INSIGHT_NUMBER')
12+
13+
import nexmo
14+
15+
client = nexmo.Client(key=NEXMO_API_KEY, secret=NEXMO_API_SECRET)
16+
17+
insight_json = client.get_advanced_number_insight(number=INSIGHT_NUMBER)
18+
pprint(insight_json)

number-insight/ni-basic.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import os
2+
from os.path import join, dirname
3+
from pprint import pprint
4+
from dotenv import load_dotenv
5+
6+
dotenv_path = join(dirname(__file__), '../.env')
7+
load_dotenv(dotenv_path)
8+
9+
NEXMO_API_KEY = os.getenv('NEXMO_API_KEY')
10+
NEXMO_API_SECRET = os.getenv('NEXMO_API_SECRET')
11+
INSIGHT_NUMBER = os.getenv('INSIGHT_NUMBER')
12+
13+
import nexmo
14+
15+
client = nexmo.Client(key=NEXMO_API_KEY, secret=NEXMO_API_SECRET)
16+
17+
insight_json = client.get_basic_number_insight(number=INSIGHT_NUMBER)
18+
pprint(insight_json)

number-insight/ni-standard.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import os
2+
from os.path import join, dirname
3+
from pprint import pprint
4+
from dotenv import load_dotenv
5+
6+
dotenv_path = join(dirname(__file__), '../.env')
7+
load_dotenv(dotenv_path)
8+
9+
NEXMO_API_KEY = os.getenv('NEXMO_API_KEY')
10+
NEXMO_API_SECRET = os.getenv('NEXMO_API_SECRET')
11+
INSIGHT_NUMBER = os.getenv('INSIGHT_NUMBER')
12+
13+
import nexmo
14+
15+
client = nexmo.Client(key=NEXMO_API_KEY, secret=NEXMO_API_SECRET)
16+
17+
insight_json = client.get_standard_number_insight(number=INSIGHT_NUMBER)
18+
pprint(insight_json)

0 commit comments

Comments
 (0)