sstrickx / yahoofinance-api

Java Client API for Yahoo Finance
MIT License
498 stars 219 forks source link

Error Code 503 #225

Open zytan89 opened 4 months ago

zytan89 commented 4 months ago

Caused by: java.io.IOException: Server returned HTTP response code: 503 for URL: https://finance.yahoo.com/quote/%5EGSPC/options at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at java.net.HttpURLConnection.getResponseCode(Unknown Source) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(Unknown Source) at yahoofinance.util.RedirectableRequest.openConnection(RedirectableRequest.java:54) at yahoofinance.util.RedirectableRequest.openConnection(RedirectableRequest.java:34) at yahoofinance.histquotes2.CrumbManager.setCookie(CrumbManager.java:52)

I am currently getting error 503 when getting request. Anyone facing similar issue?

code-monkey-101 commented 4 months ago

Yeah, since yesterday. This fixed it for me:

image

You might also have to be on Java 1.8 to set the user agent like that. I've tried a newer Java version once and it didn't work.

zytan89 commented 4 months ago

I tested on java 17 it seem to work fine. You are my savior.

BrianHee commented 4 months ago

@code-monkey-101 Bless you 🙏

joshualj commented 1 month ago

Hi All,

My JDK is 1.8, and I have filled in the "User-Agent" value. But, with the debugger, I see a responseCode of -1 downstream of the new call

redirectableRequest.openConnection(requestProperties);

Any advice?

Screenshot 2024-07-10 at 5 34 59 PM Screenshot 2024-07-10 at 4 37 00 PM Screenshot 2024-07-10 at 5 36 58 PM

Yeah, since yesterday. This fixed it for me:

image

You might also have to be on Java 1.8 to set the user agent like that. I've tried a newer Java version once and it didn't work.