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

requests.get(api_url) ISSUE

Open yylscott opened this issue 4 years ago • 2 comments

Hi Nick,

I was trying to follow your code under 'Algorithmic Trading Using Python - Full Course'.

However, I came across an error when I was trying to request data from api_url as per the attached screenshot.

Could you pleaes let me know why this happened? 0L4S){LG9K5`~GC}~)}J7_8

Regards,

Scott

yylscott avatar Jul 11 '21 11:07 yylscott

@yylscott usually you want to post the actual text of the error in the issue report. Here is a question while you do that. What happens when you google that "ConnectionError" string?

Also note you use anaconda and I don't think that is mentioned in the code as well as you are getting an SSL error so are you behind a firewall of some kind ?

datatalking avatar Jul 19 '21 02:07 datatalking

@yylscott That error is raised because of unnecessary spaces in your url string

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

remove those spaces, and it would work. api_url = f'https://sandbox.iexapis.com/stable/stock/{symbol}/quote/?token={IEX_CLOUD_API_TOKEN}'

nandwani-rohit avatar Oct 20 '21 22:10 nandwani-rohit