question

Upvotes
Accepted
1 0 0 0

module 'DatastreamPy' has no attribute 'Datastream'

I am trying to run the same code as in codebk, on my mac

it says "module 'DatastreamPy' has no attribute 'Datastream'"

pythonworkspace#technologydatastream-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
27.6k 67 18 14

Hello @Insights.Team

The Codebook use DatastreamPy version 1.0.12.

codebook.png

If you installed the library from the PyPI website, the latest version is 2.0.12 which has changed the API interfaces. You can find more detail about the new API interfaces from the PyPI website or Getting started with Python that my colleague has mention above.

import DatastreamPy as dsweb
# loading credentials from a config file
ds = dsweb.DataClient('Config.ini')


# loading credentials directly into the constructor
ds = dsweb.DataClient(None, 'YourID', 'YourPwd')

For the configuration file option you can specify your credentials with the following configuration section:

[credentials]
# Replace YourID and YourPwd values with your specific Datastream credentials.
username=YourID
password=YourPwd

I did a quick test, and it works fine on my end.

dsws.png


codebook.png (32.8 KiB)
dsws.png (49.7 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.

Upvotes
86.2k 292 53 79

@Insights.Team

Thank you for reaching out to us.

Codebook may use the different version of DatastreamPy. The latest version uses the following code

import DatastreamPy as DSWS
ds = DSWS.DataClient(None, username = username, password = password)

For more information, please refer to the Getting started with Python.

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.