Discover Refinitiv
MyRefinitiv Refinitiv Perspectives Careers
Created with Sketch.
All APIs Questions & Answers  Register |  Login
Ask a question
  • Questions
  • Tags
  • Badges
  • Unanswered
Search:
  • Home /
  • TRKD /
avatar image
Question by andrew.davies · Jan 15, 2018 at 07:25 AM · pythontrkdfundamental dataindustry classification

Python code Industry Classification TRKD

Hi Community,

Does anyone have a sample python script to select INDUSTRY CLASSIFICATION from TRKD?

Best,

Andrew

People who like this

0 Show 0
Comment
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

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

1 Reply

  • Sort: 
avatar image
REFINITIV
Best Answer
Answer by chavalit.jintamalit · Jan 15, 2018 at 09:55 PM

Hi @andrew.davies

From theGet Industry Classification Schema Full Hierarchy call on TRKD catalog at LINK.

Here is the sample code:

import requests
import json
import sys

appid = raw_input('Please input appid: ')
token = raw_input('Please input token: ')

requestMsg1 = \
    {
        "GetIndustryClassificationSchemaFullHierarchy_Request_1":
        {
            "TaxonomyCode": "RBSS2004",
            "LanguageCode": "en-US"
        }
    } 


requestURL = 'http://api.trkd.thomsonreuters.com/api/Fundamentals/Fundamentals.svc/REST/Fundamentals_1/GetIndustryClassificationSchemaFullHierarchy_1'
headers = {'content-type': 'application/json;charset=utf-8', 'X-Trkd-Auth-ApplicationID': appid, 'X-Trkd-Auth-Token': token}

result = requests.post(requestURL, data = json.dumps(requestMsg1), headers=headers)

resultText = result.text
print resultText.encode(sys.stdout.encoding, errors='replace')

You can inspect the JSON sample request on the TRKD catalog and change the code accordingly.

Red circle is URL endpoint which your request will be sent to.

Pink circle is a token generated from TRKD Create Service Token call.

Blue circle is an application ID assigned to your login.

Green circle is an input.

Here is the sample code to generate a token:

import requests
import json
import getpass

##get username, password and applicationid
username = raw_input('Please input username: ')
##use getpass.getpass to hide user inputted password
password = getpass.getpass(prompt='Please input password: ')
appid = raw_input('Please input appid: ')

##create authentication request URL, message and header

#{
#    "CreateServiceToken_Request_1":{
#      "ApplicationID": <application id>,
#      "Username": <username>,
#      "Password": <password>
#   }
#}

authenMsg = {'CreateServiceToken_Request_1': { 'ApplicationID':appid, 'Username':username,'Password':password }}
authenURL = 'https://api.trkd.thomsonreuters.com/api/TokenManagement/TokenManagement.svc/REST/Anonymous/TokenManagement_1/CreateServiceToken_1'
headers = {'content-type': 'application/json;charset=utf-8'}

#send request
result = requests.post(authenURL, data = json.dumps(authenMsg), headers=headers)

if result.status_code == 200:
   print 'Request success'
   print 'response status %s'%(result.status_code)
   ##get Token
   token = result.json()['CreateServiceToken_Response_1']['Token']
   print 'Token: %s'%(token)
   ##get expiration
   expire = result.json()['CreateServiceToken_Response_1']['Expiration']
   print 'Expire: %s'%(expire)
elif result.status_code == 500:
   print 'Request fail'
   print 'response status %s'%(result.status_code)
   print 'Error: %s'%(result.json())

print result.text
#{
#  "CreateServiceToken_Response_1": {
#    "Expiration": "2016-09-26T09:42:54.4335265Z",
#     "Token": "xxxxxxxxxx..."
#  }
#}

trkd.png (207.2 KiB)
trkd2.png (21.3 KiB)
Comment

People who like this

0 Show 1 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

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

avatar image
andrew.davies · Jan 16, 2018 at 03:20 AM 0
Share

Hi,

Thanks very much for this, much appreciated!

Andrew

Watch this question

Add to watch list
Add to your watch list to receive emailed updates for this question. Too many emails? Change your settings >
7 People are following this question.

Related Questions

get data using API in python

How to get quarterly fundamental-financial data in TRKD api

how to get historic fundamental-financial data for more than 6 years using TRKD api

Retrieve financial data of companies trading on other global exchanges

How do I get more than 5 years of fundamental data from the TRKD API?

  • Feedback
  • Copyright
  • Cookie Policy
  • Privacy Statement
  • Terms of Use
  • Careers
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Alpha
  • App Studio
  • Block Chain
  • Bot Platform
  • Calais
  • Connected Risk APIs
  • DSS
  • Data Fusion
  • Data Model Discovery
  • Datastream
  • Eikon COM
  • Eikon Data APIs
  • Elektron
    • EMA
    • ETA
    • WebSocket API
  • Legal One
  • Messenger Bot
  • Messenger Side by Side
  • ONESOURCE
    • Indirect Tax
  • Open PermID
    • Entity Search
  • Org ID
  • PAM
    • PAM - Logging
  • ProView
  • ProView Internal
  • Product Insight
  • Project Tracking
  • Refinitiv Data Platform
    • Refinitiv Data Platform Libraries
  • Rose's Space
  • Screening
    • Qual-ID API
    • Screening Deployed
    • Screening Online
    • World-Check One
    • World-Check One Zero Footprint
  • Side by Side Integration API
  • TR Knowledge Graph
  • TREP APIs
    • CAT
    • DACS Station
    • Open DACS
    • RFA
    • UPA
  • TREP Infrastructure
  • TRIT
  • TRKD
  • TRTH
  • Thomson One Smart
  • Transactions
    • REDI API
  • Velocity Analytics
  • Wealth Management Web Services
  • World-Check Data File
  • Explore
  • Tags
  • Questions
  • Badges