I have a script that loops over an array of numbers, those numbers are passed to a function which calls and API. It returns JSON data which is then written to a CSV.
for label_number in label_array:
call_api(domain, api_call_1, api_call_2, label_number, api_key)
The list can be up to 7000 elements big, as the API takes a few seconds to respond this can take hours to run the entire script. Multiprocessing seems the way to go with this. I can't quite working out how to do this with the above loop. The documentation I am looking at is
https://docs.python.org/3.5/library/multiprocessing.html
I found a similar article at
Python Multiprocessing a for loop
But manipulating it doesn't seem to work, I think I am buggering it up when it comes to passing all the variables into the function.
Any help would be appreciated.