Use equivalent to DSGRID in Python DSWS

Hi all,


I have to call the equivalent of the following EXCEL function (that I got from a Refinitiv customer service rep) in Python:

=@DSGRID("LFRUSS3L0610"," ","Latest Value","","","RowHeader=true;ColHeader=true;DispSeriesDescription=true;DispDatatypeDescription=true","")

It should return the constituents of the Russel3000 in June 2010.


Could you please help me out with building the correct query with PyDSWS for this?

So far I tried (using my credentials for UID and PASS)

ds = PyDSWS.Datastream('UID', 'PASS')

ds.get_data('LFRUSS3L0610', date=dt.date.today())


but I get just an NA


Best Answer

  • Jirapongse
    Jirapongse admin
    Answer ✓

    @Tulkkas

    You can test the request with the Datastream Test Rest Service website.

    First, use the Get Token service method to get a token. Then, use the Data (HTTP GET) to retrieve the data.

    1637811266243.png

    You should see the following output.

    1637811328083.png

    You may enable debug logging in Python with the following code to verify the request and response messages.

    import logging
    import http.client 
    http.client.HTTPConnection.debuglevel = 1 
    logging.basicConfig()
    logging.getLogger().setLevel(logging.DEBUG)
    requests_log = logging.getLogger("requests.packages.urllib3")
    requests_log.setLevel(logging.DEBUG)
    requests_log.propagate = True


Answers