Hi, I'm a new Datastream WebServices user. I tried to connect to DatastreamDSWS via Python using the following code:
import DatastreamDSWS as DSWS
ds = DSWS.Datastream(username="XXXXXXX", password="XXXXXXXX")
but have been getting the following error:
_get_token : Exception Occured (<class 'AttributeError'>, AttributeError("'str' object has no attribute 'name'"), <traceback object at 0x10f9b1320>) None
Traceback (most recent call last): File "/opt/anaconda3/envs/recommendation_2020/lib/python3.7/site-packages/DatastreamDSWS/DS_Response.py", line 259, in _get_token verify=self.certfile.name).json() AttributeError: 'str' object has no attribute 'name'
I'm assuming my DSWS account is active as was able to get a token from: http://product.datastream.com/DswsClient/Docs/TestSoapV1.aspx
I can replicate this issue on the Linux system (Non-Windows). It looks like to be a bug in the library. The workaround is using this code:
import requests ds = DSWS.Datastream(username = 'xxxxx', password = 'xxxx', sslCer=requests.certs.where())
You can also raise this issue via GitHub.
I cannot replicate the issue with DatastreamDSWS version 1.0.2 and Python versions 3.6.10, 3.7.7 in my environment.
Which version of DatastreamDSWS that you are using? You can use pip list command in your active environment to check the installed libraries versions.
(dsws36) C:\>pip list Package Version --------------- ------------------- certifi 2020.4.5.1 chardet 3.0.4 DatastreamDSWS 1.0.2 DateTime 4.3 idna 2.9 numpy 1.18.2 pandas 1.0.3 pip 20.0.2 python-dateutil 2.8.1 pytz 2019.3 requests 2.23.0 setuptools 46.1.3.post20200330 six 1.14.0 urllib3 1.25.8 wheel 0.34.2 wincertstore 0.2 zope.interface 5.1.0