File tree Expand file tree Collapse file tree 14 files changed +161
-39
lines changed
search_for_available_numbers Expand file tree Collapse file tree 14 files changed +161
-39
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
1
+ """
2
+ Sinch Python Snippet
3
+
4
+ This snippet is available at https://github.com/sinch/sinch-sdk-python-snippets
5
+ """
6
+
7
+ import os
8
+ from dotenv import load_dotenv
1
9
from sinch import SinchClient
2
10
11
+ load_dotenv ()
12
+
3
13
sinch_client = SinchClient (
4
- project_id = "YOUR_PROJECT_ID " ,
5
- key_id = "KEY_ID " ,
6
- key_secret = "KEY_SECRET "
14
+ project_id = os . environ . get ( "SINCH_PROJECT_ID" ) or "MY_PROJECT_ID " ,
15
+ key_id = os . environ . get ( "SINCH_KEY_ID" ) or "MY_KEY_ID " ,
16
+ key_secret = os . environ . get ( "SINCH_KEY_SECRET" ) or "MY_KEY_SECRET "
7
17
)
8
18
9
- phone_number = "YOUR_RENTED_PHONE_NUMBER "
19
+ phone_number = "MY_SINCH_PHONE_NUMBER "
10
20
response = sinch_client .numbers .get (phone_number = phone_number )
11
21
12
22
print (f"Rented number details:\n { response } " )
Original file line number Diff line number Diff line change
1
+ """
2
+ Sinch Python Snippet
3
+
4
+ This snippet is available at https://github.com/sinch/sinch-sdk-python-snippets
5
+ """
6
+
7
+ import os
8
+ from dotenv import load_dotenv
1
9
from sinch import SinchClient
2
10
11
+ load_dotenv ()
12
+
3
13
sinch_client = SinchClient (
4
- project_id = "YOUR_PROJECT_ID " ,
5
- key_id = "KEY_ID " ,
6
- key_secret = "KEY_SECRET "
14
+ project_id = os . environ . get ( "SINCH_PROJECT_ID" ) or "MY_PROJECT_ID " ,
15
+ key_id = os . environ . get ( "SINCH_KEY_ID" ) or "MY_KEY_ID " ,
16
+ key_secret = os . environ . get ( "SINCH_KEY_SECRET" ) or "MY_KEY_SECRET "
7
17
)
8
18
9
19
active_numbers = sinch_client .numbers .list (
Original file line number Diff line number Diff line change
1
+ """
2
+ Sinch Python Snippet
3
+
4
+ This snippet is available at https://github.com/sinch/sinch-sdk-python-snippets
5
+ """
6
+
7
+ import os
8
+ from dotenv import load_dotenv
1
9
from sinch import SinchClient
2
10
11
+ load_dotenv ()
12
+
3
13
sinch_client = SinchClient (
4
- project_id = "YOUR_PROJECT_ID " ,
5
- key_id = "KEY_ID " ,
6
- key_secret = "KEY_SECRET "
14
+ project_id = os . environ . get ( "SINCH_PROJECT_ID" ) or "MY_PROJECT_ID " ,
15
+ key_id = os . environ . get ( "SINCH_KEY_ID" ) or "MY_KEY_ID " ,
16
+ key_secret = os . environ . get ( "SINCH_KEY_SECRET" ) or "MY_KEY_SECRET "
7
17
)
8
18
9
19
active_numbers = sinch_client .numbers .list (
Original file line number Diff line number Diff line change
1
+ """
2
+ Sinch Python Snippet
3
+
4
+ This snippet is available at https://github.com/sinch/sinch-sdk-python-snippets
5
+ """
6
+
7
+ import os
8
+ from dotenv import load_dotenv
1
9
from sinch import SinchClient
2
10
11
+ load_dotenv ()
12
+
3
13
sinch_client = SinchClient (
4
- project_id = "YOUR_PROJECT_ID " ,
5
- key_id = "KEY_ID " ,
6
- key_secret = "KEY_SECRET "
14
+ project_id = os . environ . get ( "SINCH_PROJECT_ID" ) or "MY_PROJECT_ID " ,
15
+ key_id = os . environ . get ( "SINCH_KEY_ID" ) or "MY_KEY_ID " ,
16
+ key_secret = os . environ . get ( "SINCH_KEY_SECRET" ) or "MY_KEY_SECRET "
7
17
)
8
18
9
19
phone_number = "PHONE_NUMBER_TO_BE_RELEASED"
Original file line number Diff line number Diff line change
1
+ """
2
+ Sinch Python Snippet
3
+
4
+ This snippet is available at https://github.com/sinch/sinch-sdk-python-snippets
5
+ """
6
+
7
+ import os
8
+ from dotenv import load_dotenv
1
9
from sinch import SinchClient
2
10
from sinch .domains .numbers .models .v1 .types import VoiceConfigurationDictType
3
11
12
+ load_dotenv ()
13
+
4
14
sinch_client = SinchClient (
5
- project_id = "YOUR_PROJECT_ID " ,
6
- key_id = "KEY_ID " ,
7
- key_secret = "KEY_SECRET "
15
+ project_id = os . environ . get ( "SINCH_PROJECT_ID" ) or "MY_PROJECT_ID " ,
16
+ key_id = os . environ . get ( "SINCH_KEY_ID" ) or "MY_KEY_ID " ,
17
+ key_secret = os . environ . get ( "SINCH_KEY_SECRET" ) or "MY_KEY_SECRET "
8
18
)
9
19
10
20
phone_number = "PHONE_NUMBER"
Original file line number Diff line number Diff line change
1
+ """
2
+ Sinch Python Snippet
3
+
4
+ This snippet is available at https://github.com/sinch/sinch-sdk-python-snippets
5
+ """
6
+
7
+ import os
8
+ from dotenv import load_dotenv
1
9
from sinch import SinchClient
2
10
11
+ load_dotenv ()
12
+
3
13
sinch_client = SinchClient (
4
- project_id = "YOUR_PROJECT_ID " ,
5
- key_id = "KEY_ID " ,
6
- key_secret = "KEY_SECRET "
14
+ project_id = os . environ . get ( "SINCH_PROJECT_ID" ) or "MY_PROJECT_ID " ,
15
+ key_id = os . environ . get ( "SINCH_KEY_ID" ) or "MY_KEY_ID " ,
16
+ key_secret = os . environ . get ( "SINCH_KEY_SECRET" ) or "MY_KEY_SECRET "
7
17
)
8
18
9
19
phone_number = "PHONE_NUMBER"
Original file line number Diff line number Diff line change 1
- from sinch .domains .numbers .models .v1 .types import SmsConfigurationDict
1
+ """
2
+ Sinch Python Snippet
3
+
4
+ This snippet is available at https://github.com/sinch/sinch-sdk-python-snippets
5
+ """
6
+
7
+ import os
8
+ from dotenv import load_dotenv
2
9
from sinch import SinchClient
10
+ from sinch .domains .numbers .models .v1 .types import SmsConfigurationDict
11
+
12
+ load_dotenv ()
3
13
4
14
sinch_client = SinchClient (
5
- project_id = "YOUR_PROJECT_ID " ,
6
- key_id = "KEY_ID " ,
7
- key_secret = "KEY_SECRET "
15
+ project_id = os . environ . get ( "SINCH_PROJECT_ID" ) or "MY_PROJECT_ID " ,
16
+ key_id = os . environ . get ( "SINCH_KEY_ID" ) or "MY_KEY_ID " ,
17
+ key_secret = os . environ . get ( "SINCH_KEY_SECRET" ) or "MY_KEY_SECRET "
8
18
)
9
19
10
20
phone_number = "AVAILABLE_PHONE_NUMBER_TO_BE_RENTED"
Original file line number Diff line number Diff line change
1
+ """
2
+ Sinch Python Snippet
3
+
4
+ This snippet is available at https://github.com/sinch/sinch-sdk-python-snippets
5
+ """
6
+
7
+ import os
8
+ from dotenv import load_dotenv
1
9
from sinch import SinchClient
2
10
from sinch .domains .numbers .models .v1 .types import (
3
11
NumberPatternDict , SmsConfigurationDict , VoiceConfigurationDictType
4
12
)
5
13
14
+ load_dotenv ()
15
+
6
16
sinch_client = SinchClient (
7
- project_id = "YOUR_PROJECT_ID " ,
8
- key_id = "KEY_ID " ,
9
- key_secret = "KEY_SECRET "
17
+ project_id = os . environ . get ( "SINCH_PROJECT_ID" ) or "MY_PROJECT_ID " ,
18
+ key_id = os . environ . get ( "SINCH_KEY_ID" ) or "MY_KEY_ID " ,
19
+ key_secret = os . environ . get ( "SINCH_KEY_SECRET" ) or "MY_KEY_SECRET "
10
20
)
11
21
12
22
sms_configuration : SmsConfigurationDict = {
You can’t perform that action at this time.
0 commit comments