mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-12 16:22:17 -05:00
fix static scan
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
import random
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from urllib import parse
|
from urllib import parse
|
||||||
|
|
||||||
@@ -164,13 +163,8 @@ def provider_to_use(notification_type, international=True):
|
|||||||
)
|
)
|
||||||
raise Exception("No active {} providers".format(notification_type))
|
raise Exception("No active {} providers".format(notification_type))
|
||||||
|
|
||||||
if len(active_providers) == 1:
|
# we only have sns
|
||||||
chosen_provider = active_providers[0]
|
chosen_provider = active_providers[0]
|
||||||
else:
|
|
||||||
weights = [p.priority for p in active_providers]
|
|
||||||
chosen_provider = random.choices(active_providers, weights=weights)[
|
|
||||||
0
|
|
||||||
] # nosec B311 - not sec/crypto related
|
|
||||||
|
|
||||||
return notification_provider_clients.get_client_by_name_and_type(
|
return notification_provider_clients.get_client_by_name_and_type(
|
||||||
chosen_provider.identifier, notification_type
|
chosen_provider.identifier, notification_type
|
||||||
|
|||||||
Reference in New Issue
Block a user