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

ssl error accessing yahoo finance #18

Closed
hlandgar opened this issue Nov 7, 2014 · 14 comments
Closed

ssl error accessing yahoo finance #18

hlandgar opened this issue Nov 7, 2014 · 14 comments

Comments

@hlandgar
Copy link

hlandgar commented Nov 7, 2014

[1] pry(main)> StockQuote::Stock.quote("aapl")
OpenSSL::SSL::SSLError: hostname "query.yahooapis.com" does not match the server certificate
from /home/hlandgar/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/openssl/ssl.rb:178:in `post_connection_check

@tyrauber
Copy link
Owner

tyrauber commented Nov 7, 2014

@hlandgar, Any more details? I installed 1.1.8 and ran the same query in irb successfully.

@hlandgar
Copy link
Author

hlandgar commented Nov 7, 2014

Seeing the same error both locally and on heroku. Started yesterday. Just check again and it is working. Yahoo must have has a temporary certificate issue that they fixed overnight. BTW, nice gem.

Best,

Harris

Harris Landgarten
LHJ Technology Solutions, Inc.
516 299-8390

----- Original Message -----
From: "Ty Rauber" notifications@github.com
To: "tyrauber/stock_quote" stock_quote@noreply.github.com
Cc: "hlandgar" harrisl@lhjonline.com
Sent: Friday, November 7, 2014 12:40:48 AM
Subject: Re: [stock_quote] ssl error accessing yahoo finance (#18)

@hlandgar, Any more details? I installed 1.1.8 and ran the same query in irb successfully.


Reply to this email directly or view it on GitHub:
#18 (comment)

@tyrauber
Copy link
Owner

tyrauber commented Nov 7, 2014

Glad it's sorted!

@tyrauber tyrauber closed this as completed Nov 7, 2014
@dcu
Copy link

dcu commented Nov 7, 2014

I'm still getting the same error :/ I think it's a problem in yahoo's side. Is there a way to disable the SSL verification?

Chrome marks this as unsafe: https://query.yahooapis.com/v1/public/yql

@hlandgar
Copy link
Author

hlandgar commented Nov 7, 2014

Issue back for me too. Could be yahoo does certificate maintenance of some kind but you should take a look.

Harris Landgarten
LHJ Technology Solutions, Inc.
516 299-8390

----- Original Message -----
From: "David Cuadrado" notifications@github.com
To: "tyrauber/stock_quote" stock_quote@noreply.github.com
Cc: "hlandgar" harrisl@lhjonline.com
Sent: Friday, November 7, 2014 5:17:01 PM
Subject: Re: [stock_quote] ssl error accessing yahoo finance (#18)

I'm still getting the same error :/


Reply to this email directly or view it on GitHub:
#18 (comment)

@tyrauber tyrauber reopened this Nov 8, 2014
@tyrauber
Copy link
Owner

tyrauber commented Nov 8, 2014

Odd. Just checked again, and everything is working fine for me. Maybe it is a regional issue?

@hlandgar, @dcu, Are you able to make a query to yahooapis.com directly?

@hlandgar
Copy link
Author

hlandgar commented Nov 8, 2014

I just checked and it is working again for me. Either yahoo is screwing around with certificates or maybe some of their servers have good certs and some not. It seems to be a yahoo issue in any case but not regional. You might want optionally trap this error and see if the data is good.

Harris Landgarten
LHJ Technology Solutions, Inc.
516 299-8390

----- Original Message -----
From: "Ty Rauber" notifications@github.com
To: "tyrauber/stock_quote" stock_quote@noreply.github.com
Cc: "hlandgar" harrisl@lhjonline.com
Sent: Friday, November 7, 2014 9:09:51 PM
Subject: Re: [stock_quote] ssl error accessing yahoo finance (#18)

Odd. Just checked again, and everything is working fine for me. Maybe it is a regional issue?

@hlandgar, @dcu, Are you able to make a query to yahooapis.com directly?


Reply to this email directly or view it on GitHub:
#18 (comment)

@dcu
Copy link

dcu commented Nov 8, 2014

In the meantime this hack worked for me:

OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE

NOTE: it'll print a lot of warning messages saying it is unsafe

@dcu
Copy link

dcu commented Nov 8, 2014

When querying yahoo from chrome I get this ssl error:

The identity of this website has not been verified.
• Server's certificate does not match the URL.

@tyrauber
Copy link
Owner

tyrauber commented Nov 8, 2014

@dcu, @hlandgar, thanks for the additional info. Unfortunately, I don't think there is much I can do. Unfortunately, I can't recreate the issue, and if I could, it appears to be a DNS/SSL issue with yahoo.

The gem test suite uses VCR, so we could in fact capture the response. We would at least be able to confirm the response is invalid. You'd need to:

  • a) clone the repo: $ git clone git@github.com:tyrauber/stock_quote.git
  • b) delete the spec/support/vcr_cassettes directory
  • c) run the suite: $rspec

Just one of those VCR cassettes would allow me to debug the problem, and see if there was anything I can do.

EDIT:

With that being said, if you can't even open this url in a browser then the cassette isn't going to be much different.

If you are using this gem in production, you might want to take a look at this gem:
tradeking You'll need an api key from them, but service wise it will provide a lot more data than yahoo's api.

@tyrauber
Copy link
Owner

tyrauber commented Nov 8, 2014

Scratch that. There is something we can do. We just need to tell RestClient not verify the SSL cert.

@dcu, @hlandgar, Can one of you confirm the fix in this branch, fix/verify_ssl, works?

In rails, in your GEMFILE:

     gem 'stock_quote', github: 'git@github.com:tyrauber/stock_quote.git', branch: 'fix/verify_ssl'

Then bundle install.

If this fixes the issue, I'll merge it in and do a version bump.

@hlandgar
Copy link
Author

hlandgar commented Nov 8, 2014

It wasn't working but is now with the git fix so you most likely fixed it. And you didn't break anything.

Harris

Harris Landgarten
LHJ Technology Solutions, Inc.
516 299-8390

----- Original Message -----
From: "Ty Rauber" notifications@github.com
To: "tyrauber/stock_quote" stock_quote@noreply.github.com
Cc: "hlandgar" harrisl@lhjonline.com
Sent: Friday, November 7, 2014 10:01:59 PM
Subject: Re: [stock_quote] ssl error accessing yahoo finance (#18)

Scratch that. There is something we can do. We just need to tell RestClient not verify the SSL cert.

@dcu, @hlandgar, Can one of you confirm the fix in this branch, fix/verify_ssl, works?

In rails, in your GEMFILE:

     gem 'stock_quote', github: 'git@github.com:tyrauber/stock_quote.git', branch: 'fix/verify_ssl'

Then bundle install.

If this fixes the issue, I'll merge it in and do a version bump.


Reply to this email directly or view it on GitHub:
#18 (comment)

@hlandgar
Copy link
Author

hlandgar commented Nov 8, 2014

On further checking 1.18 is getting ssl errors on heroku but my local install with the git fix is working fine.

Harris

Harris Landgarten
LHJ Technology Solutions, Inc.
516 299-8390

----- Original Message -----
From: "Harris Landgarten" harrisl@lhjonline.com
To: "tyrauber/stock_quote" reply@reply.github.com
Cc: "tyrauber/stock_quote" stock_quote@noreply.github.com
Sent: Friday, November 7, 2014 10:13:29 PM
Subject: Re: [stock_quote] ssl error accessing yahoo finance (#18)

It wasn't working but is now with the git fix so you most likely fixed it. And you didn't break anything.

Harris

Harris Landgarten
LHJ Technology Solutions, Inc.
516 299-8390

----- Original Message -----
From: "Ty Rauber" notifications@github.com
To: "tyrauber/stock_quote" stock_quote@noreply.github.com
Cc: "hlandgar" harrisl@lhjonline.com
Sent: Friday, November 7, 2014 10:01:59 PM
Subject: Re: [stock_quote] ssl error accessing yahoo finance (#18)

Scratch that. There is something we can do. We just need to tell RestClient not verify the SSL cert.

@dcu, @hlandgar, Can one of you confirm the fix in this branch, fix/verify_ssl, works?

In rails, in your GEMFILE:

     gem 'stock_quote', github: 'git@github.com:tyrauber/stock_quote.git', branch: 'fix/verify_ssl'

Then bundle install.

If this fixes the issue, I'll merge it in and do a version bump.


Reply to this email directly or view it on GitHub:
#18 (comment)

@tyrauber
Copy link
Owner

tyrauber commented Nov 8, 2014

Awesome! Merged and bumped to version 1.2.0.

 gem 'stock_quote',  '~> 1.2'

Thanks @hlandgar and @dcu

@tyrauber tyrauber closed this as completed Nov 8, 2014
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

3 participants