File tree Expand file tree Collapse file tree 13 files changed +107
-36
lines changed
search_for_available_numbers Expand file tree Collapse file tree 13 files changed +107
-36
lines changed Original file line number Diff line number Diff line change @@ -4,3 +4,26 @@ Sinch Python SDK Code Snippets Repository
44
55This repository contains code snippets demonstrating usage of the
66[ Sinch Python SDK] ( https://github.com/sinch/sinch-sdk-python ) .
7+
8+
9+ ## Functions Demonstrated
10+
11+ - ** Active Numbers**
12+ - [ List active numbers] ( snippets/numbers/active_numbers/list/snippet.py )
13+ - [ List active numbers (auto pagination)] ( snippets/numbers/active_numbers/list_auto/snippet.py )
14+ - [ Retrieve an active phone number] ( snippets/numbers/active_numbers/get/snippet.py )
15+ - [ Update an active phone number] ( snippets/numbers/active_numbers/update/snippet.py )
16+ - [ Release an active number] ( snippets/numbers/active_numbers/release/snippet.py )
17+
18+ - ** Available Numbers**
19+ - [ Search for available numbers] ( snippets/numbers/available_numbers/search_for_available_numbers/snippet.py )
20+ - [ Search for a specific phone number] ( snippets/numbers/available_numbers/check_availability/snippet.py )
21+ - [ Activate a new phone number] ( snippets/numbers/available_numbers/rent/snippet.py )
22+ - [ Rent any number that matches the criteria] ( snippets/numbers/available_numbers/rent_any/snippet.py )
23+
24+ - ** Available Regions**
25+ - [ List available regions] ( snippets/numbers/available_regions/list/snippet.py )
26+
27+ - ** Callback Configuration**
28+ - [ Get callbacks configuration] ( snippets/numbers/callback_configuration/get/snippet.py )
29+ - [ Update callback configuration] ( snippets/numbers/callback_configuration/update/snippet.py )
Original file line number Diff line number Diff line change 1+ import os
2+ from dotenv import load_dotenv
13from sinch import SinchClient
24
5+ load_dotenv ()
6+
37sinch_client = SinchClient (
4- project_id = "YOUR_PROJECT_ID" ,
5- key_id = "KEY_ID" ,
6- key_secret = "KEY_SECRET"
8+ project_id = os . environ [ "PROJECT_ID" ] ,
9+ key_id = os . environ [ "KEY_ID" ] ,
10+ key_secret = os . environ [ "KEY_SECRET" ]
711)
812
913phone_number = "YOUR_RENTED_PHONE_NUMBER"
Original file line number Diff line number Diff line change 1+ import os
2+ from dotenv import load_dotenv
13from sinch import SinchClient
24
5+ load_dotenv ()
6+
37sinch_client = SinchClient (
4- project_id = "YOUR_PROJECT_ID" ,
5- key_id = "KEY_ID" ,
6- key_secret = "KEY_SECRET"
8+ project_id = os . environ [ "PROJECT_ID" ] ,
9+ key_id = os . environ [ "KEY_ID" ] ,
10+ key_secret = os . environ [ "KEY_SECRET" ]
711)
812
913active_numbers = sinch_client .numbers .list (
Original file line number Diff line number Diff line change 1+ import os
2+ from dotenv import load_dotenv
13from sinch import SinchClient
24
5+ load_dotenv ()
6+
37sinch_client = SinchClient (
4- project_id = "YOUR_PROJECT_ID" ,
5- key_id = "KEY_ID" ,
6- key_secret = "KEY_SECRET"
8+ project_id = os . environ [ "PROJECT_ID" ] ,
9+ key_id = os . environ [ "KEY_ID" ] ,
10+ key_secret = os . environ [ "KEY_SECRET" ]
711)
812
913active_numbers = sinch_client .numbers .list (
Original file line number Diff line number Diff line change 1+ import os
2+ from dotenv import load_dotenv
13from sinch import SinchClient
24
5+ load_dotenv ()
6+
37sinch_client = SinchClient (
4- project_id = "YOUR_PROJECT_ID" ,
5- key_id = "KEY_ID" ,
6- key_secret = "KEY_SECRET"
8+ project_id = os . environ [ "PROJECT_ID" ] ,
9+ key_id = os . environ [ "KEY_ID" ] ,
10+ key_secret = os . environ [ "KEY_SECRET" ]
711)
812
913phone_number = "PHONE_NUMBER_TO_BE_RELEASED"
Original file line number Diff line number Diff line change 1+ import os
2+ from dotenv import load_dotenv
13from sinch import SinchClient
24from sinch .domains .numbers .models .v1 .types import VoiceConfigurationDictType
35
6+ load_dotenv ()
7+
48sinch_client = SinchClient (
5- project_id = "YOUR_PROJECT_ID" ,
6- key_id = "KEY_ID" ,
7- key_secret = "KEY_SECRET"
9+ project_id = os . environ [ "PROJECT_ID" ] ,
10+ key_id = os . environ [ "KEY_ID" ] ,
11+ key_secret = os . environ [ "KEY_SECRET" ]
812)
913
1014phone_number = "PHONE_NUMBER"
Original file line number Diff line number Diff line change 1+ import os
2+ from dotenv import load_dotenv
13from sinch import SinchClient
24
5+ load_dotenv ()
6+
37sinch_client = SinchClient (
4- project_id = "YOUR_PROJECT_ID" ,
5- key_id = "KEY_ID" ,
6- key_secret = "KEY_SECRET"
8+ project_id = os . environ [ "PROJECT_ID" ] ,
9+ key_id = os . environ [ "KEY_ID" ] ,
10+ key_secret = os . environ [ "KEY_SECRET" ]
711)
812
913phone_number = "PHONE_NUMBER"
Original file line number Diff line number Diff line change 1+ import os
2+ from dotenv import load_dotenv
13from sinch .domains .numbers .models .v1 .types import SmsConfigurationDict
24from sinch import SinchClient
35
6+ load_dotenv ()
7+
48sinch_client = SinchClient (
5- project_id = "YOUR_PROJECT_ID" ,
6- key_id = "KEY_ID" ,
7- key_secret = "KEY_SECRET"
9+ project_id = os . environ [ "PROJECT_ID" ] ,
10+ key_id = os . environ [ "KEY_ID" ] ,
11+ key_secret = os . environ [ "KEY_SECRET" ]
812)
913
1014phone_number = "AVAILABLE_PHONE_NUMBER_TO_BE_RENTED"
Original file line number Diff line number Diff line change 1+ import os
2+ from dotenv import load_dotenv
13from sinch import SinchClient
24from sinch .domains .numbers .models .v1 .types import (
35 NumberPatternDict , SmsConfigurationDict , VoiceConfigurationDictType
46)
57
8+ load_dotenv ()
9+
610sinch_client = SinchClient (
7- project_id = "YOUR_PROJECT_ID" ,
8- key_id = "KEY_ID" ,
9- key_secret = "KEY_SECRET"
11+ project_id = os . environ [ "PROJECT_ID" ] ,
12+ key_id = os . environ [ "KEY_ID" ] ,
13+ key_secret = os . environ [ "KEY_SECRET" ]
1014)
1115
1216sms_configuration : SmsConfigurationDict = {
Original file line number Diff line number Diff line change 1+ import os
2+ from dotenv import load_dotenv
13from sinch import SinchClient
24
5+ load_dotenv ()
6+
37sinch_client = SinchClient (
4- project_id = "YOUR_PROJECT_ID" ,
5- key_id = "KEY_ID" ,
6- key_secret = "KEY_SECRET"
8+ project_id = os . environ [ "PROJECT_ID" ] ,
9+ key_id = os . environ [ "KEY_ID" ] ,
10+ key_secret = os . environ [ "KEY_SECRET" ]
711)
812
913available_numbers = sinch_client .numbers .search_for_available_numbers (
You can’t perform that action at this time.
0 commit comments