algorithmic-trading-python
algorithmic-trading-python copied to clipboard
Hi, I am getting Jason decoder error, please help
Hi @Dereklenny ,
What Response code do you get when you run the following?:
data = requests.get(api_url)
data
If it doesn't return <Response [200]>, it means there's a problem with the API call.
You can also output the content of the Response as text to see what it contains (see code snippet below). Note that because the ".json()" method is not used it does not try to parse the output to a JSON object and therefore won't generate the error. It does mean that you'd be working with a text object and not a JSON object though.
What do you get when you run the following?:
data = requests.get(api_url)
data.text
Dphugo
Hi
Thanks for the reply! I got the reply and it seemed to relate to the sandbox mode I have little experience with it
Thank you for your help
Hi @Dereklenny ,
A Response of 403 means the iexpais.com server denied the request ([(https://en.wikipedia.org/wiki/HTTP_403])
The "data.text" gives us the detail of why we got a Response of 403. It seems the token you are using is a Production token.
Have you followed the instructions below as the token contained here is for sandbox access?
Or have you registered on iexapis.com and generated an API token for yourself to trade with? If you have your own API token you would have to point the URL as shown in the response you got in "Out [6]". Note that you might incur costs if you do. I'm not familiar with iexpais.com's cost structure.
Dehugo
Hi
Thank you so much for the reply
it is my fault, I used the production token ( not sure the cost)
it works for now.
I will continue learn the rest of code
Thanks again
The real
@Dereklenny please close the issue if this has been solved