client = ImgurClient(client_id, client_secret, access_token, refresh_token)
for item in client.gallery_item_comments("c1SN8", sort='best'):
print item
This is my current code. What I'm trying to do is (hopefully) return a list of comment id's from that function. It doesn't do that, and instead outputs this.
<imgurpython.imgur.models.comment.Comment object at 0x03D8EFB0>
...
What I'm asking is if there is any combination of functions from the Imgur api to get a list of comment id's? API
In the above code item
is a Comment
Object representing the comment itself. Because it doesn't have a defined way of how to print the Object, you see imgurpython.imgur.models.comment.Comment
telling you the object type and 0x03D8EFB0
representing the address in memory that object is located at. Do not worry, that is indeed the Comment you're looking for.
Looking at the Imgur API documentation for Comment, you can see the a Comment has the following properties: id
, image_id
, comment
, author
, author_id
, on_album
, album_cover
, ups
, downs
, points
, datetime
, parent_id
, deleted
, vote
, and children
.
You can access each property by accessing item.<property>
inside the for loop. For example, if you want to print all the id
s you can do the following:
client = ImgurClient(client_id, client_secret, access_token, refresh_token)
for item in client.gallery_item_comments("c1SN8", sort='best'):
print item.id