question

Upvotes
Accepted
9 3 4 10

How to get the image file with imageId?

Hi,

I ended up having the news 'imageId' but i don't know how to get the image by using 'imageId'


here is the code :


top_news = rd.content.news.top_news.hierarchy.Definition().get_data();

front_page = rd.content.news.top_news.Definition(top_news.data.df["topNewsId"][0]).get_data()

daf = front_page.data.df

for i in range(len(daf)):

print(daf.headline[i])

print(daf.storyId[i])

print(daf.imageId[i])


but when i get the contents by using 'storyId', The image file is not included in html..

eikonrefinitiv-dataplatform-eikon#technologypython api
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hi,

Please be informed that a reply has been verified as correct in answering the question, and marked as such.

Thank you,

AHS


Upvotes
Accepted
79.2k 251 52 74

@jwlee08

Please try the code below.

from refinitiv.data.content import news top_news = news.top_news.hierarchy.Definition().get_data(); #Front Page News front_page = news.top_news.Definition(top_news.data.df["topNewsId"][0]).get_data() front_page.data.df

1702538587308.png

Then, get an image.

definition = news.images.Definition(front_page.data.df["imageId"][0]) response = definition.get_data() image = response.data.image image.show()

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hi,

1702856830588.png

I tried the same way.

but I can't see images..

and there is no show() function in 'response.data.image'

1702856921787.png

these are all i have.

what should i try?

1702856830588.png (39.6 KiB)
1702856921787.png (18.4 KiB)
Upvotes
79.2k 251 52 74

@jwlee08

I think it depends on the tool that you are using. The show method works fine on Jupyter Notebook.

1702875007591.png

You may need to use other methods, such as save. Please run the help(image) statement.


1702875007591.png (113.8 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Thank you. That helps alot!

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.