reddit_bot 1.6.0 → 1.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/examples/largeimages/Gemfile +6 -6
- data/examples/largeimages/Gemfile.lock +34 -30
- data/lib/reddit_bot.rb +11 -7
- data/lib/reddit_bot/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed538f85641e24b1db67d460183ef732ab44ee72
|
4
|
+
data.tar.gz: 07702ff0d6b95ffdb0f4877b922f09fc339fe8a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07bc678bf7a32015325f7ba18f9343da143791a7b2b37771400dfb1fb7359728f460f9c475978b50a2a9d0eb729ac373e58e4774afbb70de719258d17e9b3fbc
|
7
|
+
data.tar.gz: 00fb4e6b37364087b6b80c08af5a4355ac1398b525091afc01da697678de0b1f60b16c315427cdb13b99fa949e4a3862a525b7b006f30cc35a54b86ba2c29d7e
|
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
gem "json"
|
4
4
|
|
5
|
-
gem "nethttputils", git: "git@github.com:Nakilon/nethttputils.git"
|
5
|
+
gem "nethttputils", git: "git@github.com:Nakilon/nethttputils.git"
|
6
6
|
|
7
|
-
gem "reddit_bot", "~>1.
|
7
|
+
gem "reddit_bot", "~>1.6.0"
|
8
8
|
gem "nokogiri"
|
9
9
|
|
10
|
-
gem "imgur2array", git: "git@github.com:Nakilon/imgur2array.git"
|
11
|
-
gem "fastimage", "
|
12
|
-
gem "url2dimensions", git: "git@github.com:Nakilon/url2dimensions.git", tag: "v0.0.0.
|
10
|
+
gem "imgur2array", git: "git@github.com:Nakilon/imgur2array.git"
|
11
|
+
gem "fastimage", git: "git@github.com:Nakilon/fastimage.git"
|
12
|
+
gem "url2dimensions", git: "git@github.com:Nakilon/url2dimensions.git", tag: "v0.0.0.8"
|
13
13
|
|
14
|
-
gem "gcplogger", git: "git@github.com:Nakilon/gcplogger.git", tag: "v0.
|
14
|
+
gem "gcplogger", git: "git@github.com:Nakilon/gcplogger.git", tag: "v0.1.1.0"
|
15
15
|
gem "google-cloud-error_reporting"
|
@@ -1,60 +1,63 @@
|
|
1
|
+
GIT
|
2
|
+
remote: git@github.com:Nakilon/fastimage.git
|
3
|
+
revision: 1be9e5cd7a4ac9baa3c83efdd0bf111a52e69f48
|
4
|
+
specs:
|
5
|
+
fastimage (2.1.1)
|
6
|
+
|
1
7
|
GIT
|
2
8
|
remote: git@github.com:Nakilon/gcplogger.git
|
3
|
-
revision:
|
4
|
-
tag: v0.
|
9
|
+
revision: 7c1451fac49bd0d242c6de43315ae6e9a70d8f7f
|
10
|
+
tag: v0.1.1.0
|
5
11
|
specs:
|
6
|
-
gcplogger (0.
|
7
|
-
google-cloud-logging
|
12
|
+
gcplogger (0.1.1.0)
|
13
|
+
google-cloud-logging (~> 1.4.0)
|
14
|
+
public_suffix (~> 2.0)
|
8
15
|
|
9
16
|
GIT
|
10
17
|
remote: git@github.com:Nakilon/imgur2array.git
|
11
|
-
revision:
|
12
|
-
tag: v0.0.2.9
|
18
|
+
revision: c7bf5078aafc7958cdcb6b31836c68c44ffe978c
|
13
19
|
specs:
|
14
|
-
imgur2array (0.0.
|
20
|
+
imgur2array (0.0.3.1)
|
15
21
|
|
16
22
|
GIT
|
17
23
|
remote: git@github.com:Nakilon/nethttputils.git
|
18
24
|
revision: 620051619245a3b0b00447817831c6fb676d3df7
|
19
|
-
tag: v0.1.2.0
|
20
25
|
specs:
|
21
26
|
nethttputils (0.1.2.0)
|
22
27
|
|
23
28
|
GIT
|
24
29
|
remote: git@github.com:Nakilon/url2dimensions.git
|
25
|
-
revision:
|
26
|
-
tag: v0.0.0.
|
30
|
+
revision: c738e255ba3bbd38d142aebabbc0ea13abac4750
|
31
|
+
tag: v0.0.0.8
|
27
32
|
specs:
|
28
|
-
url2dimensions (0.0.0.
|
33
|
+
url2dimensions (0.0.0.8)
|
29
34
|
|
30
35
|
GEM
|
31
36
|
remote: https://rubygems.org/
|
32
37
|
specs:
|
33
38
|
addressable (2.5.2)
|
34
39
|
public_suffix (>= 2.0.2, < 4.0)
|
35
|
-
faraday (0.
|
40
|
+
faraday (0.14.0)
|
36
41
|
multipart-post (>= 1.2, < 3)
|
37
|
-
|
38
|
-
addressable (~> 2.3, >= 2.3.5)
|
39
|
-
google-cloud-core (1.1.0)
|
42
|
+
google-cloud-core (1.2.0)
|
40
43
|
google-cloud-env (~> 1.0)
|
41
44
|
google-cloud-env (1.0.1)
|
42
45
|
faraday (~> 0.11)
|
43
|
-
google-cloud-error_reporting (0.
|
44
|
-
google-cloud-core (~> 1.
|
45
|
-
google-gax (~> 0
|
46
|
-
stackdriver-core (~> 1.
|
47
|
-
google-cloud-logging (1.
|
46
|
+
google-cloud-error_reporting (0.30.0)
|
47
|
+
google-cloud-core (~> 1.2)
|
48
|
+
google-gax (~> 1.0)
|
49
|
+
stackdriver-core (~> 1.3)
|
50
|
+
google-cloud-logging (1.4.0)
|
48
51
|
google-cloud-core (~> 1.1)
|
49
|
-
google-gax (~> 0
|
52
|
+
google-gax (~> 1.0)
|
50
53
|
stackdriver-core (~> 1.2)
|
51
|
-
google-gax (0.
|
54
|
+
google-gax (1.0.1)
|
52
55
|
google-protobuf (~> 3.2)
|
53
56
|
googleapis-common-protos (>= 1.3.5, < 2.0)
|
54
57
|
googleauth (~> 0.6.2)
|
55
58
|
grpc (>= 1.7.2, < 2.0)
|
56
59
|
rly (~> 0.2.3)
|
57
|
-
google-protobuf (3.5.
|
60
|
+
google-protobuf (3.5.1.2)
|
58
61
|
googleapis-common-protos (1.3.7)
|
59
62
|
google-protobuf (~> 3.0)
|
60
63
|
googleapis-common-protos-types (~> 1.0)
|
@@ -69,25 +72,25 @@ GEM
|
|
69
72
|
multi_json (~> 1.11)
|
70
73
|
os (~> 0.9)
|
71
74
|
signet (~> 0.7)
|
72
|
-
grpc (1.
|
75
|
+
grpc (1.10.0)
|
73
76
|
google-protobuf (~> 3.1)
|
74
77
|
googleapis-common-protos-types (~> 1.0.0)
|
75
78
|
googleauth (>= 0.5.1, < 0.7)
|
76
79
|
json (2.1.0)
|
77
|
-
jwt (1.
|
80
|
+
jwt (2.1.0)
|
78
81
|
little-plugger (1.1.4)
|
79
82
|
logging (2.2.2)
|
80
83
|
little-plugger (~> 1.1)
|
81
84
|
multi_json (~> 1.10)
|
82
85
|
memoist (0.16.0)
|
83
86
|
mini_portile2 (2.1.0)
|
84
|
-
multi_json (1.
|
87
|
+
multi_json (1.13.1)
|
85
88
|
multipart-post (2.0.0)
|
86
89
|
nokogiri (1.6.8.1)
|
87
90
|
mini_portile2 (~> 2.1.0)
|
88
91
|
os (0.9.6)
|
89
92
|
public_suffix (2.0.5)
|
90
|
-
reddit_bot (1.
|
93
|
+
reddit_bot (1.6.0)
|
91
94
|
json
|
92
95
|
rly (0.2.3)
|
93
96
|
signet (0.8.1)
|
@@ -95,20 +98,21 @@ GEM
|
|
95
98
|
faraday (~> 0.9)
|
96
99
|
jwt (>= 1.5, < 3.0)
|
97
100
|
multi_json (~> 1.10)
|
98
|
-
stackdriver-core (1.
|
101
|
+
stackdriver-core (1.3.0)
|
102
|
+
google-cloud-core (~> 1.2)
|
99
103
|
|
100
104
|
PLATFORMS
|
101
105
|
ruby
|
102
106
|
|
103
107
|
DEPENDENCIES
|
104
|
-
fastimage
|
108
|
+
fastimage!
|
105
109
|
gcplogger!
|
106
110
|
google-cloud-error_reporting
|
107
111
|
imgur2array!
|
108
112
|
json
|
109
113
|
nethttputils!
|
110
114
|
nokogiri
|
111
|
-
reddit_bot (~> 1.
|
115
|
+
reddit_bot (~> 1.6.0)
|
112
116
|
url2dimensions!
|
113
117
|
|
114
118
|
BUNDLED WITH
|
data/lib/reddit_bot.rb
CHANGED
@@ -191,17 +191,15 @@ module RedditBot
|
|
191
191
|
|
192
192
|
def resp_with_token mtd, path, form
|
193
193
|
fail unless path.start_with? ?/
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
}
|
199
|
-
end
|
200
|
-
_
|
194
|
+
reddit_resp mtd, "https://oauth.reddit.com" + path, form, {
|
195
|
+
"Authorization" => "bearer #{token}",
|
196
|
+
"User-Agent" => "bot/#{@username}/#{RedditBot::VERSION} by /u/nakilon",
|
197
|
+
}
|
201
198
|
end
|
202
199
|
|
203
200
|
def reddit_resp *args
|
204
201
|
mtd, url, form, headers, base_auth = *args
|
202
|
+
begin
|
205
203
|
NetHTTPUtils.request_data(url, mtd, form: form, header: headers, auth: base_auth) do |response|
|
206
204
|
next unless remaining = response.to_hash["x-ratelimit-remaining"]
|
207
205
|
if Gem::Platform.local.os == "darwin"
|
@@ -217,6 +215,12 @@ module RedditBot
|
|
217
215
|
puts "sleeping #{t} seconds because of x-ratelimit"
|
218
216
|
sleep t
|
219
217
|
end
|
218
|
+
rescue NetHTTPUtils::Error => e
|
219
|
+
sleep 5
|
220
|
+
raise unless e.code == 401
|
221
|
+
@token_cached = nil
|
222
|
+
retry
|
223
|
+
end
|
220
224
|
end
|
221
225
|
|
222
226
|
end
|
data/lib/reddit_bot/version.rb
CHANGED