Where can I check how much data I have extracted using API calls for the day so as to prevent myself

Where can I check how much data I have extracted using API calls for the day so as to prevent myself from hitting the daily limit?

I have been checking the Logs from the Configuration Manager and in the log text file I get the information of my usage. Can you please let me know how frequent do the logs get updated in the log file because they do not seem to be updated dynamically on a quick real time basis?

Also, I would like to know if there is a better approach to find the amount of usage of data I have done and/or the number of API calls.

So, there is no direct way possible to get the data usage limit alert. I would like to know how frequent the logs are updated in the configuration file so that I can look into it. Can you please help me with this?

(Raising it on behalf of external client)

Answers

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @meenakshi.j

    Thank you for reaching out to us.

    To the best of my knowledge, there is currently no API available to check the usage limits for Workspace Desktop or Data Platform sessions.

    For assistance with log files, please contact the product support team directly.

  • Hi @meenakshi.j ,

    Currently, you can check the amount of your data usage by the step below

    1. Turn on the Debug log in Configuration manager in Workspace Application
      image.png
    2. In LSEG Workspace Configuration Manager, go to Logs page in Advanced section, then set Trace Level as Debug as the photo below. (This trace level may impact system performance, so consider using this only when you need to see the debug log level for troubleshooting stuff)
      image.png
    3. Then click OK to apply this configuration and please restart LSEG Workspace to let the changes taking an effect.
      image.png
    4. Then on your Python script, set log level to debug on the configuration file or in-line code and do the monkey patching to print out the response headers in the http_service file of the LSEG Data Library
    # Monkey Patching
    import lseg.data._core.session.http_service as http_service
    from httpx import Response
    
    # Save original method if needed
    original_request = http_service.HTTPService.request
    
    # Define your custom version
    def custom_request(self, request):
        response: Response = self._client.send(request)
        print(f"HTTP Response id {request.id} {response.headers}")
        return response
    
    # Monkey-patch the method
    http_service.HTTPService.request = custom_request
    
    # Set log level to debug and turn on printing the log into console (or file)
    import lseg.data as ld
    
    config = ld.get_config()
    config.set_param("logs.transports.console.enabled", True)
    # config.set_param("logs.transports.file.enabled", True)
    config.set_param("logs.level", "debug")
    
    ld.open_session()
    

    After that, when you run the Data Library's function to retrieve the data, the limit-remaining detail printed in the http response headers will be shown in console log (or log file, depend on how the configuration has been set)

    image.png

    More detail of the limit can be found inside the Refinitiv Workspace Logs folder, browse into the sub-folder with the most recently created folder with the "Desktop.<date>.<time>.p<process-ID>" folder. Then check the file named node-sxs.<date>.p<process-ID>.log

    image.png image.png

    Article related to this with more information and detail will be published by next month, I'll keep you posted.