question

Upvotes
Accepted
3 0 0 2

Datastream Web Service Python: TypeError: DataClient.post_user_request() takes from 2 to 7 positional arguments but 8 were given

OS: Ubuntu

Python version: 3.10.12

DatastreamPy version: 2.0.25

I am trying to switch to DatastreamPY from DatastreamDSWS. However, when I run codes by using DatastreamPy, error messages always show up as follows:

[Code]

import os

import pandas as pd
import DatastreamPy as dsweb

uid = os.getenv('LSEG_DS_USERID')
pwd = os.getenv('LSEG_DS_PASSWORD')

ds = dsweb.DataClient(None, uid, pwd)

data = ds.get_data(tickers='VOD', fields='P', kind=0)
print (data)

[Error messages]

Traceback (most recent call last):

File "/path/to/python/code/datastream_tmp.py", line 11, in <module>

data = ds.get_data(tickers='VOD', fields='P', kind=0)

File "/path/to/lib/python3.10/site-packages/DatastreamPy/DS_Response.py", line 276, in get_data

raise exp

File "/path/to/lib/python3.10/site-packages/DatastreamPy/DS_Response.py", line 254, in get_data

req, retName = self.post_user_request(tickers, fields, start, end, freq, kind, retName)

TypeError: DataClient.post_user_request() takes from 2 to 7 positional arguments but 8 were given


I believe the number of arguments is 3, not 8. When using DatastreamDSWS, this kind of error has never occurred. How can I resolve this issue?


python apidatastream-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.

Upvote
Accepted
83.1k 281 53 77

@tomokuni.higano01

Thank you for reaching out to us.

I can replicate this issue. I will report it to the product team.

For now, please try to use DatastreamPy==2.0.21 instead.

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
3 0 0 2

@Jirapngse

Thank you for your answer. I will use version 2.0.21.

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.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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