algorithmic-trading-python icon indicating copy to clipboard operation
algorithmic-trading-python copied to clipboard

403 Error when pulling data from api

Open ramk01 opened this issue 2 years ago • 10 comments

symbol="AAPL" api_url = f'https://sandbox.iexapis.com/stable/stock/{symbol}/quote/?token={IEX_CLOUD_API_TOKEN}'#base url #print(api_url) data=requests.get(api_url) print(data.status_code)

Hi I am using this code to pull data but instead end up getting 403 error. Any solutions?

ramk01 avatar Feb 17 '23 07:02 ramk01

Solution:

  1. Open a https://iexcloud.io/ account a.Create a new account b.Go to Dashboard and copy "secret" from WORKSPACE API token. #https://iexcloud.io/console/home c.open Jupyter file secrets.py and paste your new "secret". #http://localhost:XXXX/tree/algorithmic-trading-python/starter_files d.retry pulling data.

NTYDOLab avatar Feb 20 '23 15:02 NTYDOLab

Solution:

  1. Open a https://iexcloud.io/ account a.Create a new account b.Go to Dashboard and copy "secret" from WORKSPACE API token. #https://iexcloud.io/console/home c.open Jupyter file secrets.py and paste your new "secret". #http://localhost:XXXX/tree/algorithmic-trading-python/starter_files d.retry pulling data.

still getting the 403 status code

anilegin avatar Feb 21 '23 14:02 anilegin

This works (get your public key and change your secrets.py (in my case I had to change secrets.py to api.py as it breaks numpy)

My workspace is called Algorithmic (you can call it anilegin as an example in the console you create it.

symbol = 'AAPL' api_url = f'https://ALGORITHMIC.iex.cloud/v1/data/core/quote/{symbol}?token={IEX_CLOUD_API_TOKEN}' print(api_url) data = requests.get(api_url).json() print(data)

johnpd avatar Feb 23 '23 17:02 johnpd

better to follow the same steps as above

This works (get your public key and change your secrets.py (in my case I had to change secrets.py to api.py as it breaks numpy)

My workspace is called Algorithmic (you can call it anilegin as an example in the console you create it.

symbol = 'AAPL' api_url = f'https://ALGORITHMIC.iex.cloud/v1/data/core/quote/{symbol}?token={IEX_CLOUD_API_TOKEN}' print(api_url) data = requests.get(api_url).json() print(data)

thank you your solution had helped so much .. however I advise to do the following *this what worked for me *

  1. Create a new account
  2. Go to Dashboard and copy "public key" from WORKSPACE API token.
  3. open Jupyter file secrets.py and paste your new key.
  4. paste API URL instead it mentioned in thier docs and it is the same data as the video https://cloud.iexapis.com/stable/stock/aapl/quote?token=YOUR_TOKEN_HERE
  5. restart the kernal and try to pull the data again

the link is displayed in their website image

munirahd avatar Apr 03 '23 15:04 munirahd

import requests

symbol = "AAPL" #IEX_CLOUD_API_TOKEN = "your_api_token_here" # replace with your actual API token api_url = f'https://sandbox.iexapis.com/stable/stock/{symbol}/quote/?token=sk_47bb0c7b1acd49fe883ab7bde495b8b8' # base url

response = requests.get(api_url)

if response.status_code == 200: data = response.json() print(data) else: print(f"Error: {response.status_code}")

Still giving error 403

  1. Added new token from a new account
  2. Changed names,didnt work
  3. replaced token id with the token itself

Shanu2092 avatar Apr 03 '23 19:04 Shanu2092

But this one is real-time data which need to purchase after 7 days trial

yichenCY avatar May 24 '23 07:05 yichenCY

Solution:

  1. Open a https://iexcloud.io/ account a.Create a new account b.Go to Dashboard and copy "secret" from WORKSPACE API token. #https://iexcloud.io/console/home c.open Jupyter file secrets.py and paste your new "secret". #http://localhost:XXXX/tree/algorithmic-trading-python/starter_files d.retry pulling data.

and i change the sandbox into https://cloud.iexapis.com/, it worked then

rayna0921 avatar May 31 '23 14:05 rayna0921

This works (get your public key and change your secrets.py (in my case I had to change secrets.py to api.py as it breaks numpy)

My workspace is called Algorithmic (you can call it anilegin as an example in the console you create it.

symbol = 'AAPL' api_url = f'https://ALGORITHMIC.iex.cloud/v1/data/core/quote/{symbol}?token={IEX_CLOUD_API_TOKEN}' print(api_url) data = requests.get(api_url).json() print(data)

works for me! thanks a lot

kiet-doki avatar Jul 31 '23 19:07 kiet-doki

In my case there is no register new account button on the login/register page on IEX cloud, is there any help for this?

Ni-zav avatar Jun 13 '24 13:06 Ni-zav

In my case there is no register new account button on the login/register page on IEX cloud, is there any help for this?

I have the same issue and cannot make a new account but found this site

https://iexcloud.io/product-bulletin

They are ending their service and the data will be availibly from intrinio.com https://intrinio.com/iex-cloud

Surtur-Rising avatar Jun 20 '24 14:06 Surtur-Rising