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

Keep getting 404 response error on getting API requests

Open PandaPT opened this issue 3 years ago • 10 comments

hi I just start learning coding. while getting the API requests i keep getting the 404 error """symbol = 'APPL' api_url =f'https://sandbox.iexapis.com/stable/stock/{symbol}/quote?token={IEX_CLOUD_API_TOKEN}' print(api_url) data = requests.get(api_url) print(data)"""

Can anyone help to spot where is wrong? I have already tried clearing my computer cache and cookies. But i just keep getting stuck here :(

Thanks

PandaPT avatar May 19 '21 04:05 PandaPT

hi Panda, Please give the correct ticker name - 'AAPL' 👍

nexus326 avatar Jun 03 '21 20:06 nexus326

Hi, Please I am also getting this 404 response: symbol = 'AAPL' api_url = f'https://sandbox.iexapis.com/stable/stock/{symbol}/quote/?token{IEX_CLOUD_API_TOKEN}' data = requests.get(api_url) print(data)

and when I go ahead to try: symbol = 'AAPL' api_url = f'https://sandbox.iexapis.com/stable/stock/{symbol}/quote/?token{IEX_CLOUD_API_TOKEN}' data = requests.get(api_url).json() print(data)

it gives me this error: {'error': '"tokenTpk_059b97af715d417d9f49f50b51b1c448" is not allowed'}

Could anyone please help me find what I am getting wrong?

many thanks.

Alaidanengia avatar Jun 18 '21 07:06 Alaidanengia

Hi @Alaidanengia ,

You are missing an = sign in your api_url string between ?token and {IEX_CLOUD_API_TOKEN}:

api_url = f'https://sandbox.iexapis.com/stable/stock/{symbol}/quote/?token{IEX_CLOUD_API_TOKEN}'

Should be: api_url = f'https://sandbox.iexapis.com/stable/stock/{symbol}/quote/?token={IEX_CLOUD_API_TOKEN}'

dphugo avatar Jun 19 '21 20:06 dphugo

Woww..thanks a lot @dphugo :

I have made the correction and it has worked.

So grateful

Alaidanengia avatar Jun 19 '21 22:06 Alaidanengia

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

i am getting response<403>
how i can solve

mig9mili avatar Mar 19 '23 12:03 mig9mili

pi_url = f'https://sandbox.iexapis.com/stable/stock/{symbol}/quote/?token={IEX_CLOUD_API_TOKEN}'

have you solved getting same error .

Ayush-sacri avatar Aug 19 '23 07:08 Ayush-sacri

I haven't used this repo, so I'm not familiar with the endpoints, but try:

pi_url =f 'https://sandbox.iexapis.com/stable/stock/{symbol}/quote?token={IEX_CLOUD_API_TOKEN}'

yarbs avatar Aug 19 '23 14:08 yarbs

Hi I am getting 403 error here please help to rectify ''' symbol='AAPL' api_url=f'https://sandbox.iexapis.com/stable/stock/{symbol}/quote?token={IEX_CLOUD_API_TOKEN}' data=requests.get(api_url)

print(data.status_code) ''' output:-403

ArpitSharma08 avatar Oct 24 '23 11:10 ArpitSharma08

@ArpitSharma08,

permission issue: known user, but without privileges. see https://developer.mozilla.org/en-US/docs/Web/HTTP/Status

yarbs avatar Jan 19 '24 20:01 yarbs

@Ayush-sacri I have contacted the iexapis and they said that they have discontinued sandbox api now only paid version is available or 7 days trial else you can use other financial apis

ArpitSharma08 avatar Apr 01 '24 12:04 ArpitSharma08