@@ -19,19 +19,24 @@ class Command(BaseCommand):
1919 def handle (self , * args , ** kwargs ):
2020 logger .info ("Starting NS Inititatives" )
2121 production = settings .GO_ENVIRONMENT == "production"
22- api_key = settings .NS_INITIATIVES_API_KEY
22+ # Requires string1|string2|string3 for the three subsystems (NSIA, ESF, CBF):
23+ api_keys = settings .NS_INITIATIVES_API_KEY .split ("|" )
24+ if len (api_keys ) != 3 :
25+ logger .info ("No proper api-keys are provided. Quitting." )
26+ return
27+
2328 if production :
2429 urls = [
2530 # languageCode can be en, es, fr, ar. If omitted, defaults to en.
26- f"https://data.ifrc.org/ESF_API /api/approvedApplications?languageCode=en&apiKey={ api_key } " ,
27- f"https://data.ifrc.org/NSIA_API /api/approvedApplications?languageCode=en&apiKey={ api_key } " ,
28- f"https://data.ifrc.org/CBF_API/api/approvedApplications?languageCode=en&apiKey={ api_key } " ,
31+ f"https://data.ifrc.org/NSIA_API /api/approvedApplications?languageCode=en&apiKey={ api_keys [ 0 ] } " ,
32+ f"https://data.ifrc.org/ESF_API /api/approvedApplications?languageCode=en&apiKey={ api_keys [ 1 ] } " ,
33+ f"https://data.ifrc.org/CBF_API/api/approvedApplications?languageCode=en&apiKey={ api_keys [ 2 ] } " ,
2934 ]
3035 else :
3136 urls = [
32- f"https://data-staging.ifrc.org/ESF_API /api/approvedApplications?languageCode=en&apiKey={ api_key } " ,
33- f"https://data-staging.ifrc.org/NSIA_API /api/approvedApplications?languageCode=en&apiKey={ api_key } " ,
34- f"https://data-staging.ifrc.org/CBF_API/api/approvedApplications?languageCode=en&apiKey={ api_key } " ,
37+ f"https://data-staging.ifrc.org/NSIA_API /api/approvedApplications?languageCode=en&apiKey={ api_keys [ 0 ] } " ,
38+ f"https://data-staging.ifrc.org/ESF_API /api/approvedApplications?languageCode=en&apiKey={ api_keys [ 1 ] } " ,
39+ f"https://data-staging.ifrc.org/CBF_API/api/approvedApplications?languageCode=en&apiKey={ api_keys [ 2 ] } " ,
3540 ]
3641
3742 responses = []
0 commit comments