Я попытался обновить дату публикации своих видео через API YouTube, но я получил TypeError. Я не понимаю, почему я получаю эту ошибку. Я думал, что это может быть из-за формата даты, поэтому я попытался использовать дату вместо «2020-2-5T20: 00: 00.00 + 03: 00», но результаты не изменились. Вы можете мне помочь?
Вот мой код:
scopes = ["https://www.googleapis.com/auth/youtube.force-ssl"]
def main():
# Disable OAuthlib's HTTPS verification when running locally.
# *DO NOT* leave this option enabled in production.
os.environ["OAUTHLIB_INSECURE_TRANSPORT"] = "1"
api_service_name = "youtube"
api_version = "v3"
client_secrets_file = "client_secret.json"
flow = google_auth_oauthlib.flow.InstalledAppFlow.from_client_secrets_file(
client_secrets_file, scopes)
credentials = flow.run_console()
youtube = googleapiclient.discovery.build(
api_service_name, api_version, credentials=credentials)
date = datetime.datetime(2020, 2, 5, 20, 00)
request = youtube.videos().update(
body={
"id": 'D5sSw6Xqu34',
"status": {
"privacyStatus": "private",
"publishAt": "2020-2-5T20:00:00.00+03:00"
}
}
)
response = request.execute()
print(response)
if __name__ == "__main__":
main()
Вот ошибка:
Traceback (most recent call last):
File "C:/Users/erkan/Desktop/uppo/tekli.py", line 46, in <module>
main()
File "C:/Users/erkan/Desktop/uppo/tekli.py", line 36, in main
"publishAt": '2020-2-5T20:00:00.00+03:00',
File "C:\Users\erkan\Desktop\uppo\venv\lib\site-packages\googleapiclient\discovery.py", line 731, in method
raise TypeError('Missing required parameter "%s"' % name)
TypeError: Missing required parameter "part"
Process finished with exit code 1