question

Upvotes
Accepted
1 0 0 1

PYDSWS ds.getdata does not work

Hello,

I have an issue with the API trying to retrieve any data from Datastream using PYDSWS.
I've tested the connection and I successfully get the token.

It seems that the response from Datastream has changed or failed.

I have been using the request for years and I have not changed it.

I tried a simple and trivial request to check if it still gives me an error message and it does.

I copy below the kind of error I get:

"""

a= ds.get_data(tickers='VOD', fields='P,MV,VO', start='-10D', end='-0D', freq='D')

Traceback (most recent call last):


File "C:\Users\raiteri\AppData\Local\Temp/ipykernel_20332/2751661119.py", line 1, in <module>

a= ds.get_data(tickers='VOD', fields='P,MV,VO', start='-10D', end='-0D', freq='D')


File "C:\Users\raiteri\AppData\Local\Continuum\anaconda3\lib\site-packages\PyDSWS\datastream.py", line 102, in get_data

df = self.from_json_to_df(response)


File "C:\Users\raiteri\AppData\Local\Continuum\anaconda3\lib\site-packages\PyDSWS\datastream.py", line 41, in from_json_to_df

if response_json['Dates']:


KeyError: 'Dates'

"""

Thanks in advance

Eugenio



pythondatastream-apipython api
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
Accepted
17.4k 34 12 12

Hello @eugenio.raiteri

I want to add the additional information that the PyDSWS library is a 3rd-party library (not Refinitiv official product), so you can contact the library developer directly via GitHub https://github.com/hoenie-ams/PyDSWS/issues page to report any issues about the API call.


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
8k 11 6 9

@eugenio.raiteri Hi - this is working for me:

a= ds.get_data(tickers='VOD', fields=['P','MV','VO'], start='-10D', end='0D', freq='D')
a

the fields need to be put into an array to be well formed. I hope this can help.


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
56k 145 45 65

@eugenio.raiteri

You may check the response with the http://product.datastream.com/DswsClient/Docs/TestRestV1.aspx website.

First, use the Get Token method to get a token.

Then, use the token with the Data (HTTP GET) method to get the data. Next, check the response.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
1 0 0 1

Thanks to everyone.
It was probably due the fact that Refinitv changed the URL of the request as pointed out by @wasin.w .
Best regards



icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.