I am trying to run the same code as in codebk, on my mac
it says "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'"
Hello @Insights.Team
The Codebook use DatastreamPy version 1.0.12.
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.
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.