petercerno / good-morning

Simple Python module for downloading fundamental financial data from financials.morningstar.com.
Other
189 stars 82 forks source link

Errors #6

Closed NkdmsL closed 7 years ago

NkdmsL commented 7 years ago

I tried to use the class FinancialsDownloader() class and didnt work :(.

Code example below:

fd = gm.FinancialsDownloader()
test = fd._download('APPL', 'is')

and gives the error:

with urllib2.urlopen(url) as response: NameError: name 'urllib2' is not defined ...

In order to fix the problem I changed the line 300 FROM with urllib2.urlopen(url) as response: TOwith urllib.request.urlopen(url) as response:

As soon as I overcomed the problem above I am getting the following error that is caused by line 302 json_data = json.loads(json_text) :

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I am on a dead-end situation now :(

linwoodc3 commented 7 years ago

@NkdmsL I think you need to try the example exactly as specified

import good_morning as gm
kr = gm.KeyRatiosDownloader()
kr_frames = kr.download('AAPL')

Regardign urllib2, yes, I think that made it in there from my commit somehow. I'm fixing and will send a pull request to @petercerno . I made changes this morn and had it pull back Apple stock in an environment with Python 3.5.

This is an error similar to #7