question

Upvotes
Accepted
1 1 0 2

Side by side api: launched app does not take into account Context

Capture.PNGHello Team,

I am trying to open a news (or quote, or overview) using SXS in python.

Ping and Handhsake work fine but when I launch an app, the app opens, loads but does'nt load the right context (ric)

import pandas as pd
import requests
#ping server
surl='http://127.0.0.1:9000/ping'
r = requests.get(url = surl)
r.text

Output: '9000'

#Handshake
surl='http://127.0.0.1:9000/sxs/v1'
dbody = {'command':'handshake', 
        'productId':pyproductID, 
        'appKey':myappkey}
r = requests.post(url = surl, data = dbody)
response=pd.read_json(r.text)
sessionToken=response['sessionToken'][0]
r.text

Output: json, isSuccess: true

dbody = {'command':'launch', 
        'sessionToken': sessionToken, 
        'appId':'News',
        'context': {"entities": [{'RIC': 'TRI.TO'}]}
        }
r = requests.post(url = surl, data = dbody)
r.text

Output: json, isSuccess: true, got an instance ID


The news app will open and load... the last EIKON opened ric.

Also, is there a way to pass a news ID to the news app (alternatively: what is the best way to open a news from id, using SXS)?

Thank you very much for your answer

BR

PS: could'nt post screen shot (34kb....)???

pythonside-by-side-api
icon clock
10 |1500

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

Upvote
Accepted
38.1k 71 35 53

@MF

Please try the following code instead.

import json
dbody = {'command':'launch', 
        'sessionToken': sessionToken, 
        'appId':'News',
        'context': {"entities": [{'RIC': 'TRI.TO'}]}
        }
r = requests.post(url = surl, data = json.dumps(dbody), headers={"Content-Type":"application/json"})
r.text

Or,

dbody = {'command':'launch', 
        'sessionToken': sessionToken, 
        'appId':'News',
        'context': {"entities": [{'RIC': 'IBM.N'}]}
        }
r = requests.post(url = surl, json = dbody)
r.text

For StoryId, you can use it with "NewsQuery".

dbody = {'command':'launch', 
        'sessionToken': sessionToken, 
        'appId':'News',
        'context': {"entities": [{'NewsQuery': 'urn:newsml:reuters.com:20191114:nNenT48kC:2'}]}
        }
r = requests.post(url = surl, json = dbody)
r.text
icon clock
10 |1500

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

Upvotes
1 1 0 2

Thank you very much Jirapongse,

Just tested your code lines and it works just as expected.

BR
MF

icon clock
10 |1500

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

Click below to post an Idea Post Idea