brand2csv 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
+ === 0.1.8 01.06.2013
2
+
3
+ * Save partial results and wait 1 seconds between fetching each detail
4
+
1
5
  === 0.1.7 27.05.2013
2
6
 
3
7
  * Avoid force_encoding if ruby version 1.8.*
data/README.md CHANGED
@@ -1,6 +1,21 @@
1
1
  # brand2csv
2
2
 
3
- brand2csv
4
- =========
3
+ brand2csv using swissreg.ch to get addresses.
5
4
 
6
- brand2csv using swissreg.ch
5
+ ## Usage
6
+ brand2csv 01.01.2013 "b*"
7
+
8
+ ## Help
9
+ ```
10
+ ~> brand2csv --help
11
+ /usr/local/bin/brand2csv ver.0.1.7
12
+ Usage:
13
+ brand2csv timespan
14
+ Find all brands registered in switzerland during the given timespan.
15
+ The following examples valid timespan periods:
16
+ 1.10.2005
17
+ 1.10.2005-31.10.2005
18
+ 1.10.2005, 5.10.2005-31.10.2005
19
+ The results are stored in the file ausgabe.csv.
20
+ The trademark name is either a real brand name or a link to an image.
21
+ ```
@@ -546,9 +546,9 @@ module Brand2csv
546
546
  @agent.page.forms.first.submit
547
547
  break
548
548
  rescue
549
- puts "Rescue in submit. nrTries is #{nrTries}"
549
+ puts "Rescue in submit. nrTries is #{nrTries}. Retry after a few seconds"
550
550
  nrTries += 1
551
- sleep 1
551
+ sleep 10
552
552
  exit 1 if nrTries > 3
553
553
  end
554
554
  end
@@ -562,6 +562,7 @@ module Brand2csv
562
562
  end
563
563
  @results << Swissreg::getMarkenInfoFromDetail(Nokogiri::Slop(@agent.page.body))
564
564
  @agent.back
565
+ sleep 1
565
566
  }
566
567
  filename = "#{LogDir}/vereinfachte_#{pageNr}_back.html"
567
568
  writeResponse(filename)
@@ -600,8 +601,12 @@ module Brand2csv
600
601
 
601
602
  def Brand2csv::run(timespan, marke = 'a*')
602
603
  session = Swissreg.new(timespan, marke)
603
- session.parse_swissreg
604
- session.fetchresult
604
+ begin
605
+ session.parse_swissreg
606
+ session.fetchresult
607
+ rescue Interrupt, Net::HTTP::Persistent::Error
608
+ puts "Unterbrochen. Vesuche #{session.results.size} Resultate zu speichern"
609
+ end
605
610
  Swissreg::emitCsv(session.results, "#{timespan}.csv")
606
611
  end
607
612
 
@@ -1,3 +1,3 @@
1
1
  module Brand2csv
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
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.1.7
4
+ version: 0.1.8
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-05-27 00:00:00.000000000 Z
12
+ date: 2013-06-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mechanize