Closed sher85 closed 4 years ago
I've been seeing the same issue. I'm not sure why this is happening. I'm going to look into a fix myself. My initial thoughts are that the validation on responses is incorrect and throwing this exception erroneously. Using the API documentation I was able to find https://finnhub.io/api/v1/stock/option-chain?symbol=TSLA which works without an API key in my browser. So in the mean time it may just be best to setup something with bs4 to grab the info from https.
If you have any ideas that are causing this issue, let me know here. I'd be excited to actually resolve this issue.
Okay, so I figured out the root cause. It turns out that the api is returning the message without encoding. i.e. content-type = 'text/plain'.
client.py:L52 with raise the exception that we see here. In the mean time you can add an if statement to handle this specific call. I have a hunch that this is the expected behavior by the client, and the real issue lies with the API not setting the content-type to be application/json.
I'll make a pull request either way to fix this.
Pull request I mentioned above: https://github.com/Finnhub-Stock-API/finnhub-python/pull/18 @nongdenchet
hey guys I have been busy recently. Let's me have a look
Please upgrade your library to 2.2.1
to get the fix
I have tested and confirmed that the issue is fixed for me. Thank you @KurtPrice
while using the options.chain command in jupyter notebook, the code block displayed at the end of this issue errors out. In the error description, I can read the following
followed by the actual information I was requesting which is too lengthy to show here. The code producing this error is this: