Простейший скрипт на python
import requests
import datetime
import time
header = {
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36',
'Content-Type':'application/x-www-form-urlencoded',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language':'ru-ru,ru;q=0.8,en-us;q=0.5,en;q=0.3',
'Accept-Encoding':'gzip, deflate',
'Connection':'keep-alive',
'Referer': 'https://ua.energy/diyalnist/dyspetcherska-informatsiya/dobovyj-grafik-vyrobnytstva-spozhyvannya-e-e/',
}
# с 01.01.2015 на 30 дней, но даты и количество дней можно поставить любые
start_date = datetime.datetime.strptime('01.01.2015', '%d.%m.%Y').date()
current_date = start_date
for im in range(30):
print(current_date)
data = {
'action': 'get_data_oes',
'report_date': current_date.strftime('%d.%m.%Y'),
'type': 'day',
'rnd': 0.9491192560491961
}
response = requests.post('https://ua.energy/wp-admin/admin-ajax.php', data=data, headers=header)
with open(f"energy_{current_date.strftime('%d%m%Y')}.json", "w+") as file:
file.write(response.text)
current_date += datetime.timedelta(days=1)
time.sleep(1)