Ruby net / http更改var @read_timeout

时间:2015-10-23 22:57:45

标签: ruby

以下是from numpy import * from matplotlib.pyplot import* import matplotlib.ticker as ticker from random import* nums = [] N = 10 for i in range(N): a = randint(0,10) nums.append(a) bars= [0,1,2,3,4,5,6,7,8,9] hist(nums,bins=bars) gca().yaxis.set_major_locator(ticker.MultipleLocator(1)) show()

中的代码设置默认超时
lib/ruby/2.2.1/net/http.rb

如何在代码中更改此变量?

1 个答案:

答案 0 :(得分:0)

您可以直接更改它。

url = URI.parse('http://google.com')

http = Net::HTTP.new(url.host, url.port)
http.read_timeout = 100 #seconds