最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Using the Google Photo API from Python to change the description of a photo - Stack Overflow

programmeradmin4浏览0评论

New to Python and to the Google Photo API, but trying to teach myself by creating a 'useful' tool. So far I have successfully connected to the API and extracted a list of all my albums and also a separate list of all my media. I am then analysing this data to help me find duplicates etc.

I now want to write back to the API and update the description of each photo with various pieces of information, but am struggling on how to correctly format the request.

This is a snippet of code that doesn't work. media_items_found[] contains all of my media, where mediaId is the Id of the media item. In this code I am simply trying to change the description of the first photo to be "Hello World!". However I get "unexpected keyword argument mediaItemId"

test_photo=media_items_found[0]
photo_id=test_photo['mediaId']
new_description='Hello World!'

body = {"description": new_description}
updated_item = service.mediaItems().patch(
    mediaItemId=photo_id,  
    body=body,
    updateMask="description" 
).execute()
发布评论

评论列表(0)

  1. 暂无评论