【问题标题】:Not able to change a date of my Picasa Web Albums album via Python API无法通过 Python API 更改我的 Picasa 网络相册相册的日期
【发布时间】:2011-06-01 08:04:21
【问题描述】:

我无法通过 Python API 更改我的 Picasa 网络相册 相册的日期。花了很多时间,我现在绝望了。代码:

# set values
remote_album.timestamp.text = str(get_published_as_timestamp())
remote_album.published.text = published + 'T04:01:01.000Z'

# test before
print remote_album.published
print remote_album.published.text
print remote_album.timestamp.text

# save it remotely
remote_album = picasa.Put(remote_album, remote_album.GetEditLink().href, converter=gdata.photos.AlbumEntryFromString)

# test after
print remote_album.published.text
print remote_album.timestamp.text

# :'-(

输出是:

<ns0:published xmlns:ns0="http://www.w3.org/2005/Atom">2010-12-24T04:01:01.000Z</ns0:published>
2010-12-24T04:01:01.000Z
1293148000
1970-01-15T23:12:28.000Z
1293148000

【问题讨论】:

    标签: python api gdata picasa


    【解决方案1】:

    我可以按如下方式更改我的专辑时间戳:

    album.timestamp = gdata.photos.Timestamp(
        text="%d000" % time.mktime((2010, 02, 03, 12, 00, 00, -1, -1, -1)))
    updated_album = gd_client.Put(
        album, 
        album.GetEditLink().href, 
        converter=gdata.photos.AlbumEntryFromString)
    

    显然我的代码与你的不同(我今天才刚刚开始使用 gdata api),但它展示了如何创建一个新的时间戳对象并将其分配给专辑时间戳。

    http://code.google.com/apis/picasaweb/docs/1.0/developers_guide_python.html#ModifyAlbums

    HTH

    【讨论】:

      猜你喜欢
      • 2015-02-05
      • 1970-01-01
      • 2017-07-10
      • 1970-01-01
      • 1970-01-01
      • 2011-10-18
      • 2011-10-08
      • 2014-10-05
      • 1970-01-01
      相关资源
      最近更新 更多