import requests
import json
import pandas as pd
from datetime import datetime, timedelta
history=pd.date_range(datetime.today()-timedelta(5), periods=5)
url='https://bank.gov.ua/NBUStatService/v1/statdirectory/exchange/?date={}&json'
for d in history:
response=requests.get(url.format(datetime.strftime(d, '%Y%m%d')))
print(response.text)