aranha-parsers 0.17.0 → 0.17.1
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62f1b799c069d10df8548cab6f80af270b4efe96fd515ed9bb51b52dd41a1fb0
|
4
|
+
data.tar.gz: 4277d1ede3d4d766de0578e043e35a0c34483f7e286d2ffaa130e18865793682
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6bf24b5aac72c3ff02b7b619bdfca517e86a54e96c5a9b4a8edf718837a8cbd4ec5ce1fe941df85a50701e9277753f81ea29e9313d6f8bd9f69126bbede5643
|
7
|
+
data.tar.gz: 01feebca673e547d9983eaf6f16f5a13224311db0ca8c77672290d88b19664c6fe7146ce8094fd7fa4a45721980e48c8c3250867921ff07616b543743db00676
|
@@ -2,10 +2,9 @@
|
|
2
2
|
|
3
3
|
require 'aranha/parsers/source_address/fetch_content_error'
|
4
4
|
require 'aranha/parsers/source_address/hash_http_base'
|
5
|
+
require 'eac_envs/http/error'
|
6
|
+
require 'eac_envs/http/request'
|
5
7
|
require 'eac_ruby_utils/core_ext'
|
6
|
-
require 'faraday'
|
7
|
-
require 'faraday/follow_redirects'
|
8
|
-
require 'faraday/gzip'
|
9
8
|
require 'yaml'
|
10
9
|
|
11
10
|
module Aranha
|
@@ -55,21 +54,11 @@ module Aranha
|
|
55
54
|
source.to_yaml
|
56
55
|
end
|
57
56
|
|
58
|
-
# @return [Faraday]
|
59
|
-
def faraday_connection
|
60
|
-
::Faraday.new do |f|
|
61
|
-
f.request :gzip
|
62
|
-
f.response :follow_redirects if follow_redirect?
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
57
|
def content
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
raise ::Aranha::Parsers::SourceAddress::FetchContentError.
|
71
|
-
"Get #{url} returned #{req.status.to_i}", req
|
72
|
-
)
|
58
|
+
request = http_request
|
59
|
+
request.response.body_str
|
60
|
+
rescue ::EacEnvs::Http::Error => e
|
61
|
+
raise ::Aranha::Parsers::SourceAddress::FetchContentError, e.message, request
|
73
62
|
end
|
74
63
|
|
75
64
|
def param(key, default_value)
|
@@ -82,11 +71,13 @@ module Aranha
|
|
82
71
|
|
83
72
|
private
|
84
73
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
74
|
+
# @return [EacEnvs::Http::Request]
|
75
|
+
def http_request
|
76
|
+
r = ::EacEnvs::Http::Request.new.verb(self.class.http_method).url(url)
|
77
|
+
r = headers.if_present(r) { |v| r.headers(v) }
|
78
|
+
r = body.if_present(r) { |v| r.body(v) }
|
79
|
+
r = r.follow_redirect(true) if follow_redirect?
|
80
|
+
r
|
90
81
|
end
|
91
82
|
end
|
92
83
|
end
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
require 'addressable'
|
4
4
|
require 'aranha/parsers/source_address/fetch_content_error'
|
5
|
-
require '
|
6
|
-
require '
|
5
|
+
require 'eac_envs/http/error'
|
6
|
+
require 'eac_envs/http/request'
|
7
7
|
|
8
8
|
module Aranha
|
9
9
|
module Parsers
|
@@ -39,16 +39,10 @@ module Aranha
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def content
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
c = conn.get(url)
|
47
|
-
return c.body if c.status == 200
|
48
|
-
|
49
|
-
raise ::Aranha::Parsers::SourceAddress::FetchContentError.new(
|
50
|
-
"Get #{url} returned #{c.status.to_i}", c
|
51
|
-
)
|
42
|
+
request = ::EacEnvs::Http::Request.new.url(url).retry(true).follow_redirect(true)
|
43
|
+
request.response.body_str
|
44
|
+
rescue ::EacEnvs::Http::Error => e
|
45
|
+
raise ::Aranha::Parsers::SourceAddress::FetchContentError, e.message, request
|
52
46
|
end
|
53
47
|
|
54
48
|
def serialize
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aranha-parsers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.17.
|
4
|
+
version: 0.17.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Esquilo Azul Company
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -33,7 +33,7 @@ dependencies:
|
|
33
33
|
version: '2.8'
|
34
34
|
- - ">="
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version: 2.8.
|
36
|
+
version: 2.8.3
|
37
37
|
type: :runtime
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -43,43 +43,9 @@ dependencies:
|
|
43
43
|
version: '2.8'
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: 2.8.
|
46
|
+
version: 2.8.3
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
50
|
-
requirements:
|
51
|
-
- - "~>"
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '0.112'
|
54
|
-
type: :runtime
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
requirements:
|
58
|
-
- - "~>"
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: '0.112'
|
61
|
-
- !ruby/object:Gem::Dependency
|
62
|
-
name: faraday
|
63
|
-
requirement: !ruby/object:Gem::Requirement
|
64
|
-
requirements:
|
65
|
-
- - "~>"
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
version: '2.7'
|
68
|
-
- - ">="
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
version: 2.7.4
|
71
|
-
type: :runtime
|
72
|
-
prerelease: false
|
73
|
-
version_requirements: !ruby/object:Gem::Requirement
|
74
|
-
requirements:
|
75
|
-
- - "~>"
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: '2.7'
|
78
|
-
- - ">="
|
79
|
-
- !ruby/object:Gem::Version
|
80
|
-
version: 2.7.4
|
81
|
-
- !ruby/object:Gem::Dependency
|
82
|
-
name: faraday-follow_redirects
|
48
|
+
name: eac_envs-http
|
83
49
|
requirement: !ruby/object:Gem::Requirement
|
84
50
|
requirements:
|
85
51
|
- - "~>"
|
@@ -93,33 +59,19 @@ dependencies:
|
|
93
59
|
- !ruby/object:Gem::Version
|
94
60
|
version: '0.3'
|
95
61
|
- !ruby/object:Gem::Dependency
|
96
|
-
name:
|
97
|
-
requirement: !ruby/object:Gem::Requirement
|
98
|
-
requirements:
|
99
|
-
- - "~>"
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
version: '0.1'
|
102
|
-
type: :runtime
|
103
|
-
prerelease: false
|
104
|
-
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
requirements:
|
106
|
-
- - "~>"
|
107
|
-
- !ruby/object:Gem::Version
|
108
|
-
version: '0.1'
|
109
|
-
- !ruby/object:Gem::Dependency
|
110
|
-
name: faraday-retry
|
62
|
+
name: eac_ruby_utils
|
111
63
|
requirement: !ruby/object:Gem::Requirement
|
112
64
|
requirements:
|
113
65
|
- - "~>"
|
114
66
|
- !ruby/object:Gem::Version
|
115
|
-
version: '
|
67
|
+
version: '0.112'
|
116
68
|
type: :runtime
|
117
69
|
prerelease: false
|
118
70
|
version_requirements: !ruby/object:Gem::Requirement
|
119
71
|
requirements:
|
120
72
|
- - "~>"
|
121
73
|
- !ruby/object:Gem::Version
|
122
|
-
version: '
|
74
|
+
version: '0.112'
|
123
75
|
- !ruby/object:Gem::Dependency
|
124
76
|
name: nokogiri
|
125
77
|
requirement: !ruby/object:Gem::Requirement
|