Discover Refinitiv
MyRefinitiv Refinitiv Perspectives Careers
Created with Sketch.
All APIs Questions & Answers  Register |  Login
Ask a question
  • Questions
  • Tags
  • Badges
  • Unanswered
Search:
  • Home /
  • DSS /
avatar image
Question by i.lucas · Aug 25, 2020 at 09:38 AM · pythondss rest#dss apistatus code 202

Error 202 with TickHistoryTimeAndSalesExtractionRequest

Hi,

I don't understand why I get a 202 error with the following code:


body = json.dumps({
  "ExtractionRequest": {
    "@odata.type": "#ThomsonReuters.Dss.Api.Extractions.ExtractionRequests.TickHistoryTimeAndSalesExtractionRequest",
    "ContentFieldNames": list_trade_fields,
    "IdentifierList": {
      "@odata.type": "#ThomsonReuters.Dss.Api.Extractions.ExtractionRequests.InstrumentIdentifierList",
      "InstrumentIdentifiers": [
        { "Identifier": "SOLB.TG", "IdentifierType": "Ric" }
      ],
      "ValidationOptions": {
        "AllowHistoricalInstruments": True,
        "AllowInactiveInstruments": True,
        "AllowOpenAccessInstruments": False
      },
      "UseUserPreferencesForValidationOptions": False
    },
    "Condition": {
        "ReportDateRangeType" : "Range",
        "QueryStartDate": "2019-08-01T00:00:00.000Z",
        "QueryEndDate": "2019-08-01T10:00:00.000Z"
        }
  }
})

url_post = "https://hosted.datascopeapi.reuters.com/RestApi/v1/Extractions/ExtractRaw"
header_post = {"Prefer": "respond-async, wait=30",
"Content-Type": "application/json",
"Authorization":myToken}
resp = requests.post(url_post,body, headers=header_post)


thank you for your help,

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 Gurpreet · Aug 27, 2020 at 01:45 PM

Hello @i.lucas, HTTP 202 is not an error code:

202 Accepted
The request has been accepted for processing, but the processing has not been completed. The request might or might not eventually be acted upon, as it might be disallowed when processing actually takes place.

The server sent 202 because in your request you specified:

header_post = {"Prefer": "respond-async, wait=30",

This means that instead of keeping the client connection open for extremely long time, which can be dropped by network proxies/firewalls etc, the server waits 30 seconds and informs client that data isn't ready yet. After getting this response the client should wait and invoke another request for same URL until server responds with a HTTP200 OK message. Here is a snippet for doing that in python:

# is it a 202 (in progress)
while (resp.status_code == 202):
    print("waiting...");
    # check if the response completed yet
    URL = resp.headers['Location'];
    resp = checkStatus(URL);

print("Data available on server, fetching...");
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 >
14 People are following this question.

Related Questions

How are the following tables defined in the DSS API?

DSS REST: When does a response with status code 202 an a location expire?

what is the delay (in mins or seconds) getting a response using the DSS REST API when requesting multiple timeseries for multiple instruments in a single query? could someone share some indicative guidelines?

full holdings for a fund and ETF DSS Rest API request generates Http error code : 408

How to get FX rates from DSS rest API using python? any prerequisites needs to be done from our application?

  • 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