question

Upvotes
Accepted
3 1 1 0

New DSWS user can't connect for Python 3.6

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

datastream-apidsws-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
79.2k 251 52 74

@howard.wen1

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.

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.

That did the trick. Thanks!

Upvote
24.7k 54 17 14

Hello @howard.wen1

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



python36.png (18.9 KiB)
python37.png (17.9 KiB)
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.