TRTH REST API - Could you please provide python API code to retrieve extraction ID and also Python c

Best Answer

Answers

  • Hi @Gurpreet. Thank You. I did checked on all searches and posted here. All I got was Scheduling or using specific report templates with python.

    I am looking specifically to

    python API code to retrieve extraction ID and also Python code to download extracted file.

  • Which extraction endpoint are you trying to invoke, and what are the parameters.

  • Hello @vinod.amarnath,

    Does Python Code Examples in TRTH Downloads Section, example TRTH OnDemand Intraday look to be what you are looking for? Request and retrieve IntradayBars in python?

    jobId = Extraction ID.

    Please find the explanation of the approach to asynchronous request processing in this tutorial.

  • Hi @vinod.amarnath,

    The TRTH Python Code Samples in the download tab contains the TRTH_Get_Latest_Schedule_Files example. The example demonstrates how to retrieve last extraction id and download the extraction files for a given schedule name. Below are the list of provided functions:

    • Get authentication token
    • Get the schedule ID from the schedule name
    • Get the report extraction ID for the last extraction of a schedule
    • Get the extracted file list, with for each file its ID, type, name and size
    • Download and save a file to disk (the file is referenced by its file ID)
    • Download and display the extraction notes file, without saving them to disk
    • Read and display a text file (from hard disk)
    • Read, decompress and display a zipped text file
    • Read, decompress and display a gzipped text file