File tree Expand file tree Collapse file tree 15 files changed +39
-60
lines changed
search_for_available_numbers Expand file tree Collapse file tree 15 files changed +39
-60
lines changed Original file line number Diff line number Diff line change
1
+ SINCH_PROJECT_ID =
2
+ SINCH_KEY_ID =
3
+ SINCH_KEY_SECRET =
Original file line number Diff line number Diff line change @@ -93,7 +93,6 @@ celerybeat.pid
93
93
* .sage.py
94
94
95
95
# Environments
96
- .env
97
96
.venv
98
97
env /
99
98
venv /
Original file line number Diff line number Diff line change @@ -4,26 +4,3 @@ Sinch Python SDK Code Snippets Repository
4
4
5
5
This repository contains code snippets demonstrating usage of the
6
6
[ 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 5
5
load_dotenv ()
6
6
7
7
sinch_client = SinchClient (
8
- project_id = os .environ [ "PROJECT_ID" ] ,
9
- key_id = os .environ [ "KEY_ID" ] ,
10
- key_secret = os .environ [ "KEY_SECRET" ]
8
+ project_id = os .environ . get ( "SINCH_PROJECT_ID" ) or "MY_PROJECT_ID" ,
9
+ key_id = os .environ . get ( "SINCH_KEY_ID" ) or "MY_KEY_ID" ,
10
+ key_secret = os .environ . get ( "SINCH_KEY_SECRET" ) or "MY_KEY_SECRET"
11
11
)
12
12
13
13
phone_number = "YOUR_RENTED_PHONE_NUMBER"
Original file line number Diff line number Diff line change 5
5
load_dotenv ()
6
6
7
7
sinch_client = SinchClient (
8
- project_id = os .environ [ "PROJECT_ID" ] ,
9
- key_id = os .environ [ "KEY_ID" ] ,
10
- key_secret = os .environ [ "KEY_SECRET" ]
8
+ project_id = os .environ . get ( "SINCH_PROJECT_ID" ) or "MY_PROJECT_ID" ,
9
+ key_id = os .environ . get ( "SINCH_KEY_ID" ) or "MY_KEY_ID" ,
10
+ key_secret = os .environ . get ( "SINCH_KEY_SECRET" ) or "MY_KEY_SECRET"
11
11
)
12
12
13
13
active_numbers = sinch_client .numbers .list (
Original file line number Diff line number Diff line change 5
5
load_dotenv ()
6
6
7
7
sinch_client = SinchClient (
8
- project_id = os .environ [ "PROJECT_ID" ] ,
9
- key_id = os .environ [ "KEY_ID" ] ,
10
- key_secret = os .environ [ "KEY_SECRET" ]
8
+ project_id = os .environ . get ( "SINCH_PROJECT_ID" ) or "MY_PROJECT_ID" ,
9
+ key_id = os .environ . get ( "SINCH_KEY_ID" ) or "MY_KEY_ID" ,
10
+ key_secret = os .environ . get ( "SINCH_KEY_SECRET" ) or "MY_KEY_SECRET"
11
11
)
12
12
13
13
active_numbers = sinch_client .numbers .list (
Original file line number Diff line number Diff line change 5
5
load_dotenv ()
6
6
7
7
sinch_client = SinchClient (
8
- project_id = os .environ [ "PROJECT_ID" ] ,
9
- key_id = os .environ [ "KEY_ID" ] ,
10
- key_secret = os .environ [ "KEY_SECRET" ]
8
+ project_id = os .environ . get ( "SINCH_PROJECT_ID" ) or "MY_PROJECT_ID" ,
9
+ key_id = os .environ . get ( "SINCH_KEY_ID" ) or "MY_KEY_ID" ,
10
+ key_secret = os .environ . get ( "SINCH_KEY_SECRET" ) or "MY_KEY_SECRET"
11
11
)
12
12
13
13
phone_number = "PHONE_NUMBER_TO_BE_RELEASED"
Original file line number Diff line number Diff line change 6
6
load_dotenv ()
7
7
8
8
sinch_client = SinchClient (
9
- project_id = os .environ [ "PROJECT_ID" ] ,
10
- key_id = os .environ [ "KEY_ID" ] ,
11
- key_secret = os .environ [ "KEY_SECRET" ]
9
+ project_id = os .environ . get ( "SINCH_PROJECT_ID" ) or "MY_PROJECT_ID" ,
10
+ key_id = os .environ . get ( "SINCH_KEY_ID" ) or "MY_KEY_ID" ,
11
+ key_secret = os .environ . get ( "SINCH_KEY_SECRET" ) or "MY_KEY_SECRET"
12
12
)
13
13
14
14
phone_number = "PHONE_NUMBER"
Original file line number Diff line number Diff line change 5
5
load_dotenv ()
6
6
7
7
sinch_client = SinchClient (
8
- project_id = os .environ [ "PROJECT_ID" ] ,
9
- key_id = os .environ [ "KEY_ID" ] ,
10
- key_secret = os .environ [ "KEY_SECRET" ]
8
+ project_id = os .environ . get ( "SINCH_PROJECT_ID" ) or "MY_PROJECT_ID" ,
9
+ key_id = os .environ . get ( "SINCH_KEY_ID" ) or "MY_KEY_ID" ,
10
+ key_secret = os .environ . get ( "SINCH_KEY_SECRET" ) or "MY_KEY_SECRET"
11
11
)
12
12
13
13
phone_number = "PHONE_NUMBER"
Original file line number Diff line number Diff line change 6
6
load_dotenv ()
7
7
8
8
sinch_client = SinchClient (
9
- project_id = os .environ [ "PROJECT_ID" ] ,
10
- key_id = os .environ [ "KEY_ID" ] ,
11
- key_secret = os .environ [ "KEY_SECRET" ]
9
+ project_id = os .environ . get ( "SINCH_PROJECT_ID" ) or "MY_PROJECT_ID" ,
10
+ key_id = os .environ . get ( "SINCH_KEY_ID" ) or "MY_KEY_ID" ,
11
+ key_secret = os .environ . get ( "SINCH_KEY_SECRET" ) or "MY_KEY_SECRET"
12
12
)
13
13
14
14
phone_number = "AVAILABLE_PHONE_NUMBER_TO_BE_RENTED"
You can’t perform that action at this time.
0 commit comments