I have a list with three hashes and the script should create HTTP request for each hash in the list and then save the file of the hash. for some reason, the script generates only one HTTP request and for this reason, I manage to download only one file instead of three.
all_hashes = ['07a3355f81f0dbd9f5a9a', 'e0f1d8jj3d613ad5ebda6d', 'dsafhghhhffdsfdd']
for hash in all_hashes:
params = {'apikey': 'xxxxxxxxxxxxx', 'hash': (hash)}
response = requests.get('https://www.test.com/file/download', params=params)
downloaded_file = response.content
name = response.headers['x-goog-generation']
if response.status_code == 200:
with open('%s.bin' % name, 'wb') as f:
f.write(response.content)