2017-08-28 1 views
0

Ich benutze das Boto s3-Paket, um alle Inhalte meines Buckets anzuzeigen. Wenn ich so etwas tuePython Amazon Boto S3 fortlaufender_restore Fehler

bucket = s3.get_bucket('my_bucket_name') 
for k in bucket: 
    print k.ongoing_restore 

Das obige Snippet gibt keine für alle Objekte aus. Allerdings, wenn ich einen bestimmten Schlüssel mit:

k = bucket.get_key('my_key') 
k.ongoing_restore 

dann bekomme ich eine Ausgabe von True. Aus irgendeinem Grund ist der Wert im ersten Code nicht richtig eingestellt und kann nicht herausfinden, warum. Jede Hilfe wird geschätzt!

Antwort

0

Ich kann Ihre Situation nicht reproduzieren.

Sie können Objekte normalerweise debuggen, indem Sie .__dict__ verwenden.

Hier ist meine Ausgabe:

>>> import boto 
>>> s3=boto.connect_s3() 
>>> bucket = s3.get_bucket('my-bucket') 
>>> for k in bucket: 
... print k.ongoing_restore 
... 
None 
None 
None 
None 
None 
None 
None 
None 
None 
None 
None 
None 
None 
None 
None 
None 
None 
None 
None 
>>> k = bucket.get_key('foo.zip') 
>>> k.ongoing_restore 
>>> k.__dict__ 
{'content_length': '234', 'encrypted': None, 'resp': None, 'ongoing_restore': None, 'source_version_id': None, 'content_language': None, '_storage_class': None, 'owner': None, 'filename': None, 'size': 234, 'delete_marker': False, 'etag': '"..."', 'content_encoding': None, 'content_md5': None, 'content_disposition': None, 'cache_control': None, 'metadata': {}, 'expires': None, 'version_id': None, 'x_robots_tag': None, 'last_modified': 'Sun, 06 Aug 2017 03:23:22 GMT', 'content_type': 'application/json', 'date': 'Mon, 28 Aug 2017 22:40:25 GMT', 'path': None, 'is_latest': False, 'local_hashes': {}, 'name': 'foo.zip', 'bucket': <Bucket: my-bucket>, 'expiry_date': None, 'mode': None} 
>>>