e360-tuiguang 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8aa773542ca3f57ca1b97bfde1c3b4c754bbee61
4
- data.tar.gz: 6d6e0f97a31533381cf3de54c1e0a1e72655d54e
3
+ metadata.gz: 6bbea6197ed4d3bf94a8c30c9c20b9662debc884
4
+ data.tar.gz: 7ec94d849b7f014cab2f4864a82aae2e6dd930ed
5
5
  SHA512:
6
- metadata.gz: 63e45642c916dc40a1243353c05aa79c03428d32d23bbc7a81f97de984a72555cbd419fe09717ac43b9d2636b375d0e52a0edc80de6e442506b42dae3bcadd12
7
- data.tar.gz: f01684c6e1803a38b3b9da9b4292b194b8d080686f43cf1e0bc21d3fdbdb3031cdc95eadecfdbfc7a01f7690944a35c2677388aed6bb9d3e90ac417d55246f12
6
+ metadata.gz: f5f78ab221b37c094dc33f4ab29f19009f409f98585761f4a0d5413b97c33161c2ec5dd45e61ec09d1cc4f6d691d8076c3963b282586a6734785735b2f5d3dbd
7
+ data.tar.gz: 8816ece9bb2e8a75b3f4050fd62483ebcda3ea29aea8c83135e53b93f7cf6795ed0e7c3b2b670c0846cf381676f202bbda0fa80ce408bc8d6920107f49fed124
@@ -151,6 +151,7 @@ module E360
151
151
  request["referer"] = "http://dianjing.e.360.cn/adrank?_=#{Time.now.strftime('%s%L')}"
152
152
  request["upgrade-insecure-requests"] = '1'
153
153
  request["user-agent"] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36'
154
+ retry_times = 0
154
155
  begin
155
156
  puts "Url: #{@req_url}"
156
157
  response = http.request(request)
@@ -160,12 +161,13 @@ module E360
160
161
  raise LoginExpired
161
162
  end
162
163
  end
163
- raise RequestError, "HTTP Response: #{response.code} #{response.message}" unless response.is_a?(Net::HTTPSuccess)
164
164
  unless response.is_a?(Net::HTTPSuccess)
165
+ retry_times += 1
165
166
  p 'Sleep 3s'
166
167
  sleep 3
167
168
  end
168
- end until response.is_a?(Net::HTTPSuccess)
169
+ end if !response.is_a?(Net::HTTPSuccess) && retry_times < 10
170
+ raise RequestError, "HTTP Response: #{response.code} #{response.message}" unless response.is_a?(Net::HTTPSuccess)
169
171
  @resp = response.read_body
170
172
  if response['Content-Encoding'] && response['Content-Encoding'].include?('gzip')
171
173
  @resp = Zlib::GzipReader.new(StringIO.new(@resp)).read
@@ -1,5 +1,5 @@
1
1
  module E360
2
2
  module Tuiguang
3
- VERSION = "0.1.4"
3
+ VERSION = "0.1.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: e360-tuiguang
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xiao Jie