Skip to content

Commit 6dc25db

Browse files
author
Wasin Waeosri
committed
authentication success
1 parent 60b9e4c commit 6dc25db

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

trkd_authen.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,25 @@
44
import json
55
import getpass
66

7-
#Get username, password and applicationid
7+
##Get username, password and applicationid
88
username = raw_input('Please input username: ')
9-
#use getpass.getpass to hide user inputted password
9+
##use getpass.getpass to hide user inputted password
1010
password = getpass.getpass(prompt='Please input password: ')
1111
appid = raw_input('Please input appid: ')
1212

13+
#username = 'trcsmnldauki@thomsonreuters.com'
14+
#appid = 'rkdapi'
15+
#password = 'Welcome75'
16+
1317
print '############### Sending Authentication request message to TRKD ###############'
1418

15-
#create authentication request URL, message and header
19+
##create authentication request URL, message and header
1620
authenMsg = {'CreateServiceToken_Request_1': { 'ApplicationID':appid, 'Username':username,'Password':password }}
1721
authenURL = 'https://api.trkd.thomsonreuters.com/api/TokenManagement/TokenManagement.svc/REST/Anonymous/TokenManagement_1/CreateServiceToken_1'
1822
headers = {'content-type': 'application/json;charset=utf-8'}
1923

2024
try:
21-
#send request
25+
##send request
2226
result = requests.post(authenURL, data = json.dumps(authenMsg), headers=headers)
2327
if result.status_code == 200:
2428
print 'Request success'
@@ -32,6 +36,7 @@
3236
print 'response status %s'%(result.status_code)
3337
print 'Error: %s'%(result.json())
3438
except requests.exceptions.RequestException as e:
39+
print 'Exception!!!'
3540
print e
3641
sys.exit(1)
3742

0 commit comments

Comments
 (0)