Im trying to send a list of variables to another variable so i can send all items in the list to an api call, so curently I have
I have:
module = "a"
BASE_URL = "https://api-call.io/api"
API_KEY = "abcxyz"
url = BASE_URL f"?module={module}&apikey={API_KEY}"
But I have 3 modules to send to api the api call and currently I create 3 urls
I want to create a list like:
module_list = ["a","b","c"]
And I want to send each item in the module list dynamically to the api call url 1 after the other instead of creating 3 urls
CodePudding user response:
Loop over module_list
like this:
module_list = ["a","b","c"]
BASE_URL = "https://api-call.io/api"
API_KEY = "abcxyz"
for module in module_list:
url = BASE_URL f"?module={module}&apikey={API_KEY}"
# now call the url