yahoofinance 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/ChangeLog +5 -0
  2. data/lib/yahoofinance.rb +17 -25
  3. metadata +3 -3
data/ChangeLog CHANGED
@@ -1,6 +1,11 @@
1
+ 2007-09-06 Nicholas Rahn <nick@transparentech.com>
2
+ * RELEASE 1.2.2
3
+ * lib/yahoofinance.rb: Change host for live quote data CSV download to download.finance.yahoo.com since old host doesn't work anymore; Add basic proxy support.
4
+ * Rakefile: version update.
1
5
  2007-02-14 Nicholas Rahn <nick@transparentech.com>
2
6
  * RELEASE 1.2.1
3
7
  * lib/yahoofinance.rb: Change historical data parsing due to Yahoo! Finance format change. Don't catch exceptions in YahooFinance.get.
8
+ * Rakefile: version update.
4
9
 
5
10
  2006-11-12 Nicholas Rahn <nick@transparentech.com>
6
11
  * lib/yahoofinance.rb: Improve (again) the exception handling for timeouts. Catch an 'Exception' rather than default which seems to miss the Timeout::Error.
@@ -174,30 +174,16 @@ module YahooFinance
174
174
  #
175
175
  # Don't catch any exceptions! Just let them be thrown.
176
176
  #
177
- # begin
178
- Net::HTTP.start( "finance.yahoo.com", 80 ) { |http|
179
- http.read_timeout = timeout
180
- response = nil
181
-
182
- # begin
183
- # Timeout.timeout( 1 ) {
184
- response = http.get( "/d/quotes.csv?s=#{symbols}&f=#{format}&e=.csv" )
185
- # }
186
- # rescue Exception => ex
187
- # puts "inner timeout got: #{ex.inspect}"
188
- # response = nil
189
- # end
190
-
191
- return "" if !response
192
-
193
- response.body.chomp
194
- }
195
- # rescue Exception => ex
196
- # This can often be a Timeout::Error.
197
- # puts "YahooFinance::get - #{ex.inspect}"
198
- # return ""
199
- # end
200
-
177
+ proxy = ENV['http_proxy'] ? URI.parse( ENV['http_proxy'] ) : OpenStruct.new
178
+ Net::HTTP::Proxy( proxy.host, proxy.port,
179
+ proxy.user, proxy.password ).start( "download.finance.yahoo.com",
180
+ 80 ) do |http|
181
+ http.read_timeout = timeout
182
+ response = nil
183
+ response = http.get( "/d/quotes.csv?s=#{symbols}&f=#{format}&e=.csv" )
184
+ return "" if !response
185
+ response.body.chomp
186
+ end
201
187
  end
202
188
 
203
189
  def YahooFinance.get_quotes( quote_class, symbols, &block )
@@ -419,7 +405,13 @@ module YahooFinance
419
405
  # the end date.
420
406
  return [] if startDate > endDate
421
407
 
422
- Net::HTTP.start( "itable.finance.yahoo.com", 80 ) { |http|
408
+ proxy = ENV['http_proxy'] ? URI.parse( ENV['http_proxy'] ) : OpenStruct.new
409
+ Net::HTTP::Proxy( proxy.host,
410
+ proxy.port,
411
+ proxy.user,
412
+ proxy.password ).start( "itable.finance.yahoo.com",
413
+ 80 ) { |http|
414
+ #Net::HTTP.start( "itable.finance.yahoo.com", 80 ) { |http|
423
415
  query = "/table.csv?s=#{symbol}&g=d" +
424
416
  "&a=#{startDate.month-1}&b=#{startDate.mday}&c=#{startDate.year}" +
425
417
  "&d=#{endDate.month-1}&e=#{endDate.mday}&f=#{endDate.year.to_s}"
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.0
2
+ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: yahoofinance
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.2.1
7
- date: 2007-02-14 00:00:00 +01:00
6
+ version: 1.2.2
7
+ date: 2007-09-06 00:00:00 +02:00
8
8
  summary: A package for retrieving stock quote information from Yahoo! Finance.
9
9
  require_paths:
10
10
  - lib