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 /
avatar image
Question by johan · Feb 16 at 01:10 PM · pythonrequestsput

How do I authenticate for requests PUT in Python?

I have problems getting requests.put working on the api in Python. The same way of authentication that works with GET and POST do not work with PUT. I want to make calls to this:

https://docs-developers.refinitiv.com/1600949101673/50009/documentation/schema-reference/wc1-api-schema-reference-documentation.html#_cases_casesystemid_ongoingscreening_put

PUT /cases/{caseSystemId}/ongoingScreening

I have the following things defined in my .env file:


REFINITIV_API_ENDPOINT = https://rms-world-check-one-api-pilot.thomsonreuters.com
REFINITIV_API_KEY      = abc111
REFINITIV_API_SECRET   = abc222
REFINITIV_PRODUCT_KEY  = abc333
REFINITIV_GROUP_ID     = abc444

How do I use this to make PUT calls in Python using the requests library? We are using Python 3.8.5. I am running Debian WSL on Windows 10. Everything I tried so far gives me the HTTP401 error. I know the keys work because GET and POST on other endpoints work with them.

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.

5 Replies

  • Sort: 
avatar image
REFINITIV
Best Answer
Answer by prabhjyot.mandla · Feb 16 at 01:43 PM

@johan,

I see a time difference between request and response headers of more than 30 seconds.

Can you please check the clock and try again?

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.

avatar image
REFINITIV
Answer by prabhjyot.mandla · Feb 16 at 01:16 PM

@johan

Can you please share the request and the response headers of the failed request? Also, can you please confirm the content of dataToSign which you are passing for the PUT request?

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.

avatar image
Answer by johan · Feb 16 at 01:34 PM
https://rms-world-check-one-api-pilot.thomsonreuters.com/v2/cases/{case_system_id}/ongoingScreening


PUT headers = {
"Date": "Tue, 16 Feb 2021 13:28:15 GMT",
"Authorization": "Signature keyId=\"CENCORED1\",algorithm=\"hmac-sha256\",headers=\"(request-target) host date\",signature=\"CENCORED2=\""
}

result.status_code = 401
result.headers = {'Strict-Transport-Security': 'max-age=15552000, includeSubdomains', 'Authorization': 'WWW-Authenticate: Signature realm="World-Check One API",algorithm="hmac-sha256",headers="(request-target) host date content-type content-length"', 'Transfer-Encoding': 'chunked', 'Date': 'Tue, 16 Feb 2021 13:31:55 GMT', 'Server': '""'}
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.

avatar image
Answer by johan · Feb 16 at 01:40 PM

The case_system_id I use right now is a few minutes old and I got that from making a screening request on a random name we made up.

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.

avatar image
Answer by johan · Feb 17 at 02:33 PM

Fugerad it out I think. I get 204 status back when I PUT to the endpoint with users caseSystemId. The problem was with signing the header I think.

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 >
11 People are following this question.
  • 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
  • Electronic Trading
    • Generic FIX
    • Local Bank Node API
    • Trading API
  • 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