Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code 400 on all Request #26

Open
jabber484 opened this issue Dec 28, 2020 · 3 comments
Open

Code 400 on all Request #26

jabber484 opened this issue Dec 28, 2020 · 3 comments

Comments

@jabber484
Copy link

Hello,

I am experiencing 400 in all endpoint, but using standard request.get(), i am able to fetch data.
Anyone experiencing the same thing?

ubuntu@ip-172-31-54-235:~$ python example.py
Traceback (most recent call last):
File "example.py", line 7, in
print(finnhub_client.stock_candles("AAPL", "D", 1590988249, 1591852249))
File "/home/ubuntu/.local/lib/python3.8/site-packages/finnhub/client.py", line 206, in stock_candles
return self._get("/stock/candle", params=params)
File "/home/ubuntu/.local/lib/python3.8/site-packages/finnhub/client.py", line 69, in _get
return self._request("get", path, **kwargs)
File "/home/ubuntu/.local/lib/python3.8/site-packages/finnhub/client.py", line 39, in _request
return self._handle_response(response)
File "/home/ubuntu/.local/lib/python3.8/site-packages/finnhub/client.py", line 44, in _handle_response
raise FinnhubAPIException(response)
finnhub.exceptions.FinnhubAPIException: FinnhubAPIException(status_code: 400): Malformed URL.

@rlangner
Copy link

I have the same issue

@MrNightSky
Copy link

MrNightSky commented Dec 28, 2020

I had the same case, but now it work again.

P.S. Examples from https://finnhub.io/docs/api with request work well all time when this library return the error.

@emptycamp
Copy link

emptycamp commented Dec 28, 2020

uri = "{}/{}".format(self.API_URL, path)

This line adds an additional forward slash to the URL (e.g., using ipo calendar it returns 'https://finnhub.io/api/v1//calendar/ipo').

At the time while I was getting 400 error, I tested both URLs with an additional forward slash and without. Using double forward slash returned 400 in request while using single slash worked (that's probably why API urls in docs worked when this library returned errors). Weird thing is that both URLs work now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants