brand2csv 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/lib/brand2csv.rb +21 -4
- data/lib/brand2csv/version.rb +1 -1
- metadata +2 -2
data/History.txt
CHANGED
data/lib/brand2csv.rb
CHANGED
@@ -341,8 +341,23 @@ module Brand2csv
|
|
341
341
|
url = "#{Sr300}?language=de§ion=tm&id=#{nummer}"
|
342
342
|
pp "#{Time.now.strftime("%H:%M:%S")}: Opening #{filename}" if $VERBOSE
|
343
343
|
$stdout.flush
|
344
|
-
|
345
|
-
|
344
|
+
nrRetries = 0
|
345
|
+
begin
|
346
|
+
content = @agent.get_file url
|
347
|
+
body = @agent.page.body
|
348
|
+
rescue 'getaddrinfo: Name or service not known', Exception => e
|
349
|
+
nrRetries += 1
|
350
|
+
puts e.backtrace
|
351
|
+
if nrRetries <= 3
|
352
|
+
puts "get_file did not work reinit session and retry for #{nr}. nrRetries #{nrRetries}/3. e #{e}"
|
353
|
+
sleep 60 # Sleep a minute to let network recover
|
354
|
+
init_swissreg
|
355
|
+
retry
|
356
|
+
else
|
357
|
+
puts "get_file did not work reinit session raise Interrupt"
|
358
|
+
raise Interrupt
|
359
|
+
end
|
360
|
+
end
|
346
361
|
body.force_encoding('utf-8') unless /^1\.8/.match(RUBY_VERSION)
|
347
362
|
doc = Nokogiri::Slop(body)
|
348
363
|
writeResponse(filename)
|
@@ -517,14 +532,16 @@ module Brand2csv
|
|
517
532
|
nrRetries = 0
|
518
533
|
begin
|
519
534
|
fetchDetails(nr)
|
520
|
-
rescue Exception => e
|
535
|
+
rescue SocketError, Exception => e
|
521
536
|
nrRetries += 1
|
522
537
|
puts e.backtrace
|
523
|
-
puts "fetchDetails did not work reinit session and retry for #{nr}. nrRetries #{nrRetries}/3. e #{e}"
|
524
538
|
if nrRetries <= 3
|
539
|
+
puts "fetchDetails did not work reinit session and retry for #{nr}. nrRetries #{nrRetries}/3. e #{e}"
|
540
|
+
sleep 60 # Sleep a minute to let network recover
|
525
541
|
init_swissreg
|
526
542
|
retry
|
527
543
|
else
|
544
|
+
puts "fetchDetails did not work reinit session raise Interrupt"
|
528
545
|
raise Interrupt
|
529
546
|
end
|
530
547
|
end
|
data/lib/brand2csv/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brand2csv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mechanize
|