Skip to content

Commit a98db66

Browse files
committed
twilio
1 parent b316333 commit a98db66

File tree

2 files changed

+28
-16
lines changed

2 files changed

+28
-16
lines changed
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from typing import Annotated
2+
13
from pydantic import AnyUrl, Field
24
from settings_library.basic_types import RegisteredPortInt
35

@@ -7,9 +9,9 @@
79

810

911
class TracingSettings(BaseCustomSettings):
10-
TRACING_OPENTELEMETRY_COLLECTOR_ENDPOINT: AnyUrl = Field(
11-
..., description="Opentelemetry compatible collector endpoint"
12-
)
13-
TRACING_OPENTELEMETRY_COLLECTOR_PORT: RegisteredPortInt = Field(
14-
..., description="Opentelemetry compatible collector port"
15-
)
12+
TRACING_OPENTELEMETRY_COLLECTOR_ENDPOINT: Annotated[
13+
AnyUrl, Field(description="Opentelemetry compatible collector endpoint")
14+
]
15+
TRACING_OPENTELEMETRY_COLLECTOR_PORT: Annotated[
16+
RegisteredPortInt, Field(description="Opentelemetry compatible collector port")
17+
]

packages/settings-library/src/settings_library/twilio.py

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,35 @@
1111

1212
from .base import BaseCustomSettings
1313

14-
# Based on https://countrycode.org/
1514
CountryCodeStr: TypeAlias = Annotated[
1615
str,
1716
BeforeValidator(str),
17+
# Based on https://countrycode.org/
1818
StringConstraints(strip_whitespace=True, pattern=r"^\d{1,4}"),
1919
]
2020

2121

2222
class TwilioSettings(BaseCustomSettings):
23-
TWILIO_ACCOUNT_SID: str = Field(..., description="Twilio account String Identifier")
24-
TWILIO_AUTH_TOKEN: str = Field(..., description="API tokens")
25-
TWILIO_COUNTRY_CODES_W_ALPHANUMERIC_SID_SUPPORT: list[CountryCodeStr] = Field(
26-
default=TypeAdapter(list[CountryCodeStr]).validate_python(
27-
[
28-
"41",
29-
],
23+
TWILIO_ACCOUNT_SID: Annotated[
24+
str,
25+
Field(description="Twilio account String Identifier"),
26+
]
27+
28+
TWILIO_AUTH_TOKEN: Annotated[
29+
str,
30+
Field(description="API tokens"),
31+
]
32+
33+
TWILIO_COUNTRY_CODES_W_ALPHANUMERIC_SID_SUPPORT: Annotated[
34+
list[CountryCodeStr],
35+
Field(
36+
description="list of country-codes supporting/registered for alphanumeric sender ID"
37+
"See https://support.twilio.com/hc/en-us/articles/223133767-International-support-for-Alphanumeric-Sender-ID",
3038
),
31-
description="list of country-codes supporting/registered for alphanumeric sender ID"
32-
"See https://support.twilio.com/hc/en-us/articles/223133767-International-support-for-Alphanumeric-Sender-ID",
39+
] = TypeAdapter(list[CountryCodeStr]).validate_python(
40+
[
41+
"41",
42+
],
3343
)
3444

3545
def is_alphanumeric_supported(self, phone_number: str) -> bool:

0 commit comments

Comments
 (0)