question

Upvotes
Accepted
4 0 0 1

Research API - refresh credentials 5 min before expiration

Research API user guide 2.0, page 17 says:

"Note: Cloud credentials are active for one hour; please refresh the credentials five minutes before the expiration."

Is there any sample code available for the process?

rdp-apirefinitiv-data-platformresearch
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.

Making the post public. Please don't post private questions unless confidential client information is included.

Upvotes
Accepted
13k 32 12 18
If “Atexit.register(removeSubscription)” is deleted from “startResearchAlerts() sample, currentSubscriptionID returned by “subscribeToResearch” is always the same? In other words, is it not necessary to change the below part to get current subscription ID? If yes, please advise how to change.

Your application will have to store the subscription parameters from existing subscription and skip the SubscribeToResearch() function. Calling this function again, will create a new subscription for the application - which is not what you want. At some point new subscriptions will be denied as well.

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.

Thank you so much for your help.

Upvotes
11.3k 25 8 13

Hi @Midori.Miyata,

To refresh cloud credential, application just sends a new cloud credential request. The request is exactly the same as the initial cloud credential request. For 5 minutes before expired, you can use a timer with 55 minutes expired to call the cloud credential request.

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.

Is it essentially no difference between sending a new credential request before 5 min expiration and sending it after expiration as far as using the same subscription?

Upvotes
13k 32 12 18
Is it essentially no difference between sending a new credential request before 5 min expiration and sending it after expiration as far as using the same subscription?

See the python Research Messages sample provided in the downloads tab. It does not proactively try to refresh the Cloud credentials, but does so upon expiry-exception.

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.

My client is trying to modify “startResearchAlerts()” in “researchAlert.py”. (now messageAlert.py) . He wants to retrieve all the data for the day by starting at fixed time (eg. 17pm) every day. Retrieving data takes more than 1 hour in most cases.

Please advise how to modify the code? Just deleting (atexit.register(removeSubscription) is OK?


You cannot receive messages prior to starting your subscription. For this,

1. Start subscription and don't close it upon exit.

2. Poll all accumulated messages from cloud at your required time

This requires lot more changes than just deleting atexit function.

If “Atexit.register(removeSubscription)” is deleted from “startResearchAlerts() sample, currentSubscriptionID returned by “subscribeToResearch” is always the same? In other words, is it not necessary to change the below part to get current subscription ID? If yes, please advise how to change.

print("Subscribing to research stream ...");

endpoint, cryptographyKey, currentSubscriptionID = SubscribeToResearch()


Click below to post an Idea Post Idea