Why does WordPress set the current date-time when uploading photos, instead of the one I specify in the python script?

There is a media upload function in Wordpress: def upload_media(file_path, timestamp): """ Функция загрузки фото в Wordpress """ dt = datetime.datetime.fromtimestamp(timestamp) dt = str(dt.strftime('%Y-%m-%dT%H:%M:%S')) print(f"Дата постинга фотографии: {dt}") file_path = Path(path_arh_insta + "/" + file_path) endpoint = f"{site_url}/wp-json/wp/v2/media" headers = { 'Authorization': 'Basic ' + token_wp.decode('utf-8'), "Content-Disposition": f"attachment; filename={file_path};" } with open(file_path, 'rb') as file: response = requests.post(endpoint, headers=headers, files={'file': file, 'date': timestamp, 'caption': 'Photo Instagram', 'alt_text': 'Photo Instagram'}) #response = requests.post(endpoint, headers=headers, files=media) if response.status_code == 201: print(f">>> Файл успешно загружен:\n>>> Код для вставки в пост: {response.json()['description']['rendered']}\n>>> ") return response.json()['description']['rendered'] else: logger.error(f"Ошибка загрузки файла: {response.status_code}, {response.json()['message']}") exit () The file is uploaded, but it does not set the date I need, nor the description, nor the alt. Who did this, tell me what's wrong?

Comment (0)

You’ll be in good company