Discover Refinitiv
MyRefinitiv Refinitiv Perspectives Careers
Created with Sketch.
All APIs Questions & Answers  Register |  Login
Ask a question
  • Questions
  • Tags
  • Badges
  • Unanswered
Search:
  • Home /
  • Screening /
  • World-Check One /

For a deeper look into our World Check One API, look into:

Overview |  Quickstart |  Documentation |  Downloads

avatar image
Question by kingsley · May 26, 2020 at 08:30 PM · pythonworld-checkworld-check-one

401 response on cases/screeningRequest with python

import requests
import hmac
import hashlib
import base64
import time
import json
# To get the GMT time 
stringdataformat = ("%a, %d %b %Y %H:%M:%S GMT")
datenow = time.gmtime()
date = time.strftime(dataformat, datenow)
print(date) api_key = "xxxxxxxxxxxxxxxxxxxx"  
# Enter your API key
api_secret = "xxxxxxxxxxxxxxxxxxxxxxx"  
# Enter your API secret
group_id = "xxxxxxxxxxxxxxxxxxxxxxx"  
# Enter your group Id
api_token = api_secret.encode()
path = "https://rms-world-check-one-api-pilot.thomsonreuters.com/v2/cases/screeningRequest"
gatewayurl = "/v2/"
gatewayhost = "rms-world-check-one-api-pilot.thomsonreuters.com"
content_type = "application/json" 
name1 = "putin"
entity_type = "INDIVIDUAL"
bcontent = "{\n\"secondaryFields\": [],\n  \"entityType\": \"" + entity_type + "\",\n  \"customFields\": [],\n  \"groupId\":\"" + group_id + "\",\n  \"providerTypes\": [\n    \"WATCHLIST\"\n  ],\n  \"name\": \"" + name1 + "\"}"

content = bcontent.encode('utf-8')length = len(content)
str_length = str(length)
 
datatosign = "(request-target): post " + gatewayurl + "cases/screeningRequest\n" + \             "host: " + gatewayhost + "\n" + \             "date: " + date + "\n" + \             "content-type: " + content_type + "\n" + \             "content-length: " + str_length + "\n" + \             content.decode()  

byte_datatosign = datatosign.encode() 
 
def hbase(byte_datatosign, api_token):    
encrypt = hmac.new(api_token, byte_datatosign, digestmod=hashlib.sha256)    
digest_maker = encrypt.digest()    
base = base64.b64encode(digest_maker)    
return base.decode()  

hmacbase = hbase(byte_datatosign, api_token)
print(hmacbase) 

authorisation = "Signature keyId=\"" + api_key + "\"" + ",algorithm=\"hmac-sha256\"" + ",headers=\"(request-target) host date content-type content-length\"" + ",signature=\"" + hmacbase + "\""

print(authorisation) 

headers = {     'Authorization': authorisation,    'Date': date,    'Content-Type': content_type,    'Content-Length': str_length,    'Accept': "*/*",    'Cache-Control': "no-cache",    'Host': "rms-world-check-one-api-pilot.thomsonreuters.com",    'Accept-Encoding': "gzip, deflate",    'Connection': "keep-alive",    'cache-control': "no-cache"} 

requests.post(path, data=content, headers=headers)


I'm trying to make a screening request with the following code with python and it keeps returning 401 errors. What am I doing wrong?

People who like this

0 Show 1
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.

avatar image
REFINITIV
zoya faberov ♦♦ · Jun 02, 2020 at 10:48 PM 0
Share

Hello @kingsley,

Thank you for your participation in the forum.

Is the reply below satisfactory in resolving your query? If yes please click the 'Accept' text next to the reply. This will guide all community members who have a similar question. Otherwise please post again offering further insight into your question.

Thanks,

-AHS

1 Reply

  • Sort: 
avatar image
REFINITIV
Best Answer
Answer by Prabhjyot · May 27, 2020 at 10:12 AM

@kingsley,

Thank you for your query.

Could you please refer to the python example share in the below link?

https://community.developers.refinitiv.com/questions/47570/please-can-you-post-a-sample-python-file-that-can.html

Please let us know if you need further assistance.

Comment

People who like this

0 Show 0 · 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.

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 >
12 People are following this question.

Related Questions

Getting 401 Unauthorized World Check API

"cases/{ {case-system-id}}/screeningRequest" is not updating case results when called again after case update request

MediaCheck Invalid Provider Type Error

Python Project gives 401 Error when using GetTopLevelGroupRequest. Require Python sample code to generate hmac or signature header. Python signature and Postman signature doesn't match.

Please can you post a sample python file that can perform sync screening requests for the WC1 API?

  • Copyright
  • Cookie Policy
  • Privacy Statement
  • Terms of Use
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Alpha
  • App Studio
  • Block Chain
  • Bot Platform
  • Connected Risk APIs
  • DSS
  • Data Fusion
  • Data Model Discovery
  • Datastream
  • Eikon COM
  • Eikon Data APIs
  • Electronic Trading
    • Generic FIX
    • Local Bank Node API
    • Trading API
  • Elektron
    • EMA
    • ETA
    • WebSocket API
  • Intelligent Tagging
  • Legal One
  • Messenger Bot
  • Messenger Side by Side
  • ONESOURCE
    • Indirect Tax
  • Open Calais
  • Open PermID
    • Entity Search
  • Org ID
  • PAM
    • PAM - Logging
  • ProView
  • ProView Internal
  • Product Insight
  • Project Tracking
  • RDMS
  • 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
  • TRKD
  • TRTH
  • Thomson One Smart
  • Transactions
    • REDI API
  • Velocity Analytics
  • Wealth Management Web Services
  • Workspace SDK
    • Element Framework
    • Grid
  • World-Check Data File
  • 中文论坛
  • Explore
  • Tags
  • Questions
  • Badges