pampa_workers 1.1.22 → 1.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/myremoteprocess.rb +7 -9
- data/lib/pampa_workers.rb +0 -1
- metadata +6 -7
- data/lib/mybotprocess.rb +0 -383
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d05e9a8cc39a3b4a7b116a7ec2af526f53328ae
|
4
|
+
data.tar.gz: b8a014657706b2338c386f7bab71448d71f64909
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bec6caebede25fd89d00158ab1d9b44c9ea4ac892d3a7c5c3921f18a34b700ad95710d2671bca72551f88b01d0d074220970562d8f491c96fd8d22b21ebe58fa
|
7
|
+
data.tar.gz: 68f93cc42fdcaab99247533f5aed478861858621dadfda03b9e32ff1e125cc030b421a1d57956cedc6e4d388d4f05e2f41cbdb6b020cb61bbe28ee70e45c7971
|
data/lib/myremoteprocess.rb
CHANGED
@@ -38,9 +38,7 @@ module BlackStack
|
|
38
38
|
end
|
39
39
|
|
40
40
|
#
|
41
|
-
def run()
|
42
|
-
super
|
43
|
-
|
41
|
+
def run()
|
44
42
|
# creo el objeto logger
|
45
43
|
self.logger = RemoteLogger.new(
|
46
44
|
"#{self.fullWorkerName}.log",
|
@@ -59,9 +57,9 @@ module BlackStack
|
|
59
57
|
logger.done
|
60
58
|
|
61
59
|
# actualizo los datos de este worker (parent process)
|
62
|
-
|
63
|
-
|
64
|
-
|
60
|
+
logger.logs "Update worker (1-remote)... "
|
61
|
+
self.updateWorker
|
62
|
+
logger.done
|
65
63
|
|
66
64
|
# actualizo los datos de este worker (parent process)
|
67
65
|
logger.logs "Switch logger id_client (log folder may change)... "
|
@@ -114,9 +112,9 @@ module BlackStack
|
|
114
112
|
logger.done
|
115
113
|
|
116
114
|
# actualizo los datos de este worker (parent process)
|
117
|
-
|
118
|
-
|
119
|
-
|
115
|
+
logger.logs "Update worker (2)... "
|
116
|
+
self.updateWorker
|
117
|
+
logger.done
|
120
118
|
|
121
119
|
# sleep
|
122
120
|
logger.logs "Sleep... "
|
data/lib/pampa_workers.rb
CHANGED
@@ -19,7 +19,6 @@ require_relative './mychildprocess'
|
|
19
19
|
require_relative './mylocalprocess'
|
20
20
|
require_relative './myparentprocess'
|
21
21
|
require_relative './myremoteprocess'
|
22
|
-
require_relative './mybotprocess'
|
23
22
|
require_relative './mycrawlprocess'
|
24
23
|
require_relative './remoteworker'
|
25
24
|
require_relative './remotedivision'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pampa_workers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.26
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leandro Daniel Sardi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: websocket
|
@@ -96,20 +96,20 @@ dependencies:
|
|
96
96
|
requirements:
|
97
97
|
- - "~>"
|
98
98
|
- !ruby/object:Gem::Version
|
99
|
-
version: 1.1.
|
99
|
+
version: 1.1.8
|
100
100
|
- - ">="
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: 1.1.
|
102
|
+
version: 1.1.8
|
103
103
|
type: :runtime
|
104
104
|
prerelease: false
|
105
105
|
version_requirements: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
107
|
- - "~>"
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: 1.1.
|
109
|
+
version: 1.1.8
|
110
110
|
- - ">="
|
111
111
|
- !ruby/object:Gem::Version
|
112
|
-
version: 1.1.
|
112
|
+
version: 1.1.8
|
113
113
|
description: 'THIS GEM IS STILL IN DEVELOPMENT STAGE. Find documentation here: https://github.com/leandrosardi/pampa.'
|
114
114
|
email: leandro.sardi@expandedventure.com
|
115
115
|
executables: []
|
@@ -121,7 +121,6 @@ files:
|
|
121
121
|
- lib/client.rb
|
122
122
|
- lib/division.rb
|
123
123
|
- lib/login.rb
|
124
|
-
- lib/mybotprocess.rb
|
125
124
|
- lib/mychildprocess.rb
|
126
125
|
- lib/mycrawlprocess.rb
|
127
126
|
- lib/mylocalprocess.rb
|
data/lib/mybotprocess.rb
DELETED
@@ -1,383 +0,0 @@
|
|
1
|
-
module BlackStack
|
2
|
-
|
3
|
-
# clase de base para todos los bots ejecuten acciones con una cuenta de LinkedIn, Facebook, Twitter, etc.
|
4
|
-
class MyBotProcess < BlackStack::MyRemoteProcess
|
5
|
-
attr_accessor :username, :login_verifications, :run_once, :cookies_robot
|
6
|
-
|
7
|
-
# constructor
|
8
|
-
def initialize(
|
9
|
-
the_worker_name,
|
10
|
-
the_division_name,
|
11
|
-
the_minimum_enlapsed_seconds=MyProcess::DEFAULT_MINIMUM_ENLAPSED_SECONDS,
|
12
|
-
the_verify_configuration=true,
|
13
|
-
the_email=nil,
|
14
|
-
the_password=nil
|
15
|
-
)
|
16
|
-
super(the_worker_name, the_division_name, the_minimum_enlapsed_seconds, the_verify_configuration, the_email, the_password)
|
17
|
-
self.assigned_process = File.expand_path($0)
|
18
|
-
self.worker_name = "#{the_worker_name}"
|
19
|
-
self.division_name = the_division_name
|
20
|
-
self.minimum_enlapsed_seconds = the_minimum_enlapsed_seconds
|
21
|
-
|
22
|
-
# algunas clases como CreateLnUserProcess o RepairLnUserProcess, trabajan unicamente con el username especificado en este atributo, llamando al access point get_lnuser_by_username.
|
23
|
-
# si este atributo es nil, entonces la clase pide un lnuser a la division, llamando al access point get_lnuser.
|
24
|
-
self.username = nil
|
25
|
-
|
26
|
-
# al correr un proceso sin supervision, el login require verificaciones automaticas que demoran tiempo (account blocingcaptcha, sms pin, bloqueo)
|
27
|
-
# las verificaciones consument tiempo.
|
28
|
-
# si este proceso se corre de forma supevisada, las verificaciones se pueden deshabilitar
|
29
|
-
self.login_verifications = true
|
30
|
-
|
31
|
-
# al correr sin supervision, el proceso de terminar un un paquete de procesamiento y comenzar con otro, funcionando en un loop infinito.
|
32
|
-
# si este proceso se corre de forma supevisada, se desa correr el procesamiento una unica vez.
|
33
|
-
# cuando se activa este flag, generalmente se setea el atributo self.username tambien.
|
34
|
-
self.run_once = false
|
35
|
-
|
36
|
-
# preguntar al servidor si el lnuser debe calentar el browser visitando sitios al azar para recolectar cookies
|
37
|
-
self.cookies_robot = true
|
38
|
-
end
|
39
|
-
|
40
|
-
# returns a hash with the parameters of a lnuser
|
41
|
-
# raises an exception if it could not get a lnuser, or if ocurrs any other problem
|
42
|
-
def getLnUserByUsername(username)
|
43
|
-
nTries = 0
|
44
|
-
parsed = nil
|
45
|
-
lnuser = nil # hash
|
46
|
-
bSuccess = false
|
47
|
-
sError = ""
|
48
|
-
while (nTries < 5 && bSuccess == false)
|
49
|
-
begin
|
50
|
-
nTries = nTries + 1
|
51
|
-
url = "#{BlackStack::Pampa::api_protocol}://#{self.ws_url}:#{self.ws_port}/api1.3/pampa/login.lnuser/get_lnuser.json"
|
52
|
-
res = BlackStack::Netting::call_post(url, {'api_key' => BlackStack::Pampa::api_key, 'username' => username.encode("UTF-8")})
|
53
|
-
parsed = JSON.parse(res.body)
|
54
|
-
if (parsed['status']=='success')
|
55
|
-
lnuser = parsed
|
56
|
-
bSuccess = true
|
57
|
-
else
|
58
|
-
sError = parsed['status']
|
59
|
-
end
|
60
|
-
rescue Errno::ECONNREFUSED => e
|
61
|
-
sError = "Errno::ECONNREFUSED:" + e.to_console
|
62
|
-
rescue => e2
|
63
|
-
sError = "Exception: " + e2.to_console
|
64
|
-
end
|
65
|
-
end # while
|
66
|
-
|
67
|
-
if (bSuccess==false)
|
68
|
-
raise BlackStack::Netting::ApiCallException.new(sError)
|
69
|
-
end
|
70
|
-
|
71
|
-
return lnuser
|
72
|
-
end # getLnUserByUsername()
|
73
|
-
|
74
|
-
# returns a hash with the parameters of a lnuser
|
75
|
-
# raises an exception if it could not get a lnuser, or if ocurrs any other problem
|
76
|
-
def getLnUser(workflow_name='incrawl.lnsearchvariation')
|
77
|
-
nTries = 0
|
78
|
-
parsed = nil
|
79
|
-
lnuser = nil # hash
|
80
|
-
bSuccess = false
|
81
|
-
sError = ""
|
82
|
-
while (nTries < 5 && bSuccess == false)
|
83
|
-
begin
|
84
|
-
nTries = nTries + 1
|
85
|
-
url = "#{BlackStack::Pampa::api_protocol}://#{self.ws_url}:#{self.ws_port}/api1.3/pampa/#{workflow_name}/get_lnuser.json"
|
86
|
-
res = BlackStack::Netting::call_post(url, {'api_key' => BlackStack::Pampa::api_key, 'name' => self.fullWorkerName})
|
87
|
-
parsed = JSON.parse(res.body)
|
88
|
-
if (parsed['status']=='success')
|
89
|
-
lnuser = parsed
|
90
|
-
bSuccess = true
|
91
|
-
else
|
92
|
-
sError = parsed['status']
|
93
|
-
end
|
94
|
-
rescue Errno::ECONNREFUSED => e
|
95
|
-
sError = "Errno::ECONNREFUSED:" + e.to_console
|
96
|
-
rescue => e2
|
97
|
-
sError = "Exception:" + e2.to_console
|
98
|
-
end
|
99
|
-
end # while
|
100
|
-
|
101
|
-
if (bSuccess==false)
|
102
|
-
raise BlackStack::Netting::ApiCallException.new(sError)
|
103
|
-
end
|
104
|
-
|
105
|
-
return lnuser
|
106
|
-
end # getLnUser()
|
107
|
-
|
108
|
-
#
|
109
|
-
def notifyInbox(lnuser, conv)
|
110
|
-
conv[:chats].each { |chat|
|
111
|
-
# armo URL de notificacion
|
112
|
-
# se usa URI.encode para codificar caracteres no-ascii en los mensajes
|
113
|
-
url =
|
114
|
-
"#{BlackStack::Pampa::api_protocol}://#{self.ws_url}:#{self.ws_port}/api1.3/pampa/scrape.inbox/notify_lnchat.json?" +
|
115
|
-
"api_key=#{BlackStack::Pampa::api_key}&" +
|
116
|
-
"profile_code=#{CGI.escape(conv[:profile_code])}&" +
|
117
|
-
"profile_name=#{CGI.escape(conv[:profile_name])}&" +
|
118
|
-
"profile_headline=#{CGI.escape(conv[:profile_headline])}&" +
|
119
|
-
"first=#{CGI.escape(conv[:first])}&" +
|
120
|
-
"position=#{chat[:position].to_s}&" +
|
121
|
-
"uid=#{lnuser['id']}&" +
|
122
|
-
"sender_name=#{CGI.escape(chat[:sender_name])}&" +
|
123
|
-
"body=#{CGI.escape(chat[:body])}&"
|
124
|
-
puts ""
|
125
|
-
puts "url:#{url}:."
|
126
|
-
puts ""
|
127
|
-
# HELP: File.open('./output3.txt', 'a') { |file| file.write(url + "\r\n") }
|
128
|
-
|
129
|
-
# push the chat
|
130
|
-
uri = URI.parse(url.to_s)
|
131
|
-
req = Net::HTTP::Get.new(uri.to_s)
|
132
|
-
res = Net::HTTP.start(uri.host, uri.port, :use_ssl => true, :verify_mode => OpenSSL::SSL::VERIFY_NONE) {|http|
|
133
|
-
http.request(req)
|
134
|
-
}
|
135
|
-
parsed = JSON.parse(res.body)
|
136
|
-
raise "error uploading chat: #{parsed['status']}" if parsed['status'] != 'success'
|
137
|
-
} # conv[:chats].each
|
138
|
-
end
|
139
|
-
|
140
|
-
#
|
141
|
-
def notifyLnUserUrl(id_lnuser, profile_url)
|
142
|
-
nTries = 0
|
143
|
-
parsed = nil
|
144
|
-
bSuccess = false
|
145
|
-
sError = ""
|
146
|
-
while (nTries < 5 && bSuccess == false)
|
147
|
-
begin
|
148
|
-
nTries = nTries + 1
|
149
|
-
url = "#{BlackStack::Pampa::api_protocol}://#{self.ws_url}:#{self.ws_port}/api1.3/pampa/login.lnuser/notify_url.json"
|
150
|
-
res = BlackStack::Netting::call_post(url,
|
151
|
-
{:api_key => BlackStack::Pampa::api_key,
|
152
|
-
'id_lnuser' => id_lnuser,
|
153
|
-
'url' => profile_url,}
|
154
|
-
)
|
155
|
-
parsed = JSON.parse(res.body)
|
156
|
-
|
157
|
-
if (parsed['status']=='success')
|
158
|
-
bSuccess = true
|
159
|
-
else
|
160
|
-
sError = parsed['status']
|
161
|
-
end
|
162
|
-
rescue Errno::ECONNREFUSED => e
|
163
|
-
sError = "Errno::ECONNREFUSED:" + e.to_console
|
164
|
-
rescue => e2
|
165
|
-
sError = "Exception:" + e2.to_console
|
166
|
-
end
|
167
|
-
end # while
|
168
|
-
|
169
|
-
if (bSuccess==false)
|
170
|
-
raise "#{sError}"
|
171
|
-
end
|
172
|
-
end # notifyLnUserStatus
|
173
|
-
|
174
|
-
#
|
175
|
-
def notifyLnUserStatus(id_lnuser, status, workflow_name='incrawl.lnsearchvariation')
|
176
|
-
nTries = 0
|
177
|
-
parsed = nil
|
178
|
-
bSuccess = false
|
179
|
-
sError = ""
|
180
|
-
while (nTries < 5 && bSuccess == false)
|
181
|
-
begin
|
182
|
-
nTries = nTries + 1
|
183
|
-
url = "#{BlackStack::Pampa::api_protocol}://#{self.ws_url}:#{self.ws_port}/api1.3/pampa/#{workflow_name}/notify_lnuser_status.json"
|
184
|
-
res = BlackStack::Netting::call_post(url,
|
185
|
-
{'api_key' => BlackStack::Pampa::api_key,
|
186
|
-
'id_lnuser' => id_lnuser,
|
187
|
-
'status' => status,}
|
188
|
-
)
|
189
|
-
parsed = JSON.parse(res.body)
|
190
|
-
|
191
|
-
if (parsed['status']=='success')
|
192
|
-
bSuccess = true
|
193
|
-
else
|
194
|
-
sError = parsed['status']
|
195
|
-
end
|
196
|
-
rescue Errno::ECONNREFUSED => e
|
197
|
-
sError = "Errno::ECONNREFUSED:" + e.to_console
|
198
|
-
rescue => e2
|
199
|
-
sError = "Exception:" + e2.to_console
|
200
|
-
end
|
201
|
-
end # while
|
202
|
-
|
203
|
-
if (bSuccess==false)
|
204
|
-
raise "#{sError}"
|
205
|
-
end
|
206
|
-
|
207
|
-
end # notifyLnUserStatus
|
208
|
-
|
209
|
-
#
|
210
|
-
def notifyLnUserActivity(id_lnuser, code, workflow_name='incrawl.lnsearchvariation')
|
211
|
-
nTries = 0
|
212
|
-
parsed = nil
|
213
|
-
bSuccess = false
|
214
|
-
sError = ""
|
215
|
-
while (nTries < 5 && bSuccess == false)
|
216
|
-
begin
|
217
|
-
nTries = nTries + 1
|
218
|
-
url = "#{BlackStack::Pampa::api_protocol}://#{self.ws_url}:#{self.ws_port}/api1.3/pampa/#{workflow_name}/notify_lnuser_activity.json"
|
219
|
-
res = BlackStack::Netting::call_post(url,
|
220
|
-
{'api_key' => BlackStack::Pampa::api_key,
|
221
|
-
'id_lnuser' => id_lnuser,
|
222
|
-
'code' => code,}
|
223
|
-
)
|
224
|
-
parsed = JSON.parse(res.body)
|
225
|
-
|
226
|
-
if (parsed['status']=='success')
|
227
|
-
bSuccess = true
|
228
|
-
else
|
229
|
-
sError = parsed['status']
|
230
|
-
end
|
231
|
-
rescue Errno::ECONNREFUSED => e
|
232
|
-
sError = "Errno::ECONNREFUSED:" + e.to_console
|
233
|
-
rescue => e2
|
234
|
-
sError = "Exception:" + e2.to_console
|
235
|
-
end
|
236
|
-
end # while
|
237
|
-
|
238
|
-
if (bSuccess==false)
|
239
|
-
raise "#{sError}"
|
240
|
-
end
|
241
|
-
end # notifyLnUserStatus
|
242
|
-
|
243
|
-
# Toma una captura del browser.
|
244
|
-
# Sube un registro a la tabla boterrorlog, con el id del worker, el proceso asinado, y el screenshot.
|
245
|
-
#
|
246
|
-
# uid: id de un registro en la tabla lnuser.
|
247
|
-
# description: backtrace de la excepcion.
|
248
|
-
#
|
249
|
-
def notifyError(uid, description, oid=nil)
|
250
|
-
# tomo captura de pantalla
|
251
|
-
file = nil
|
252
|
-
=begin # TODO: habilitar esto cuando se migre a RestClient en vez de CallPost
|
253
|
-
begin
|
254
|
-
screenshot_filename = "./error.png" # TODO: colocar un nombre unico formado por por el fullname del worker, y la fecha-hora.
|
255
|
-
BrowserFactory.screenshot screenshot_filename
|
256
|
-
file = File.new(screenshot_filename, "rb")
|
257
|
-
rescue => e
|
258
|
-
puts "Screenshot Error: #{e.to_s}"
|
259
|
-
file = nil
|
260
|
-
end
|
261
|
-
=end
|
262
|
-
#puts ""
|
263
|
-
#puts "id_worker:#{PROCESS.worker.id}"
|
264
|
-
#puts "worker_name:#{PROCESS.fullWorkerName}"
|
265
|
-
#puts "process:#{PROCESS.worker.assigned_process}"
|
266
|
-
#puts ""
|
267
|
-
# subo el error
|
268
|
-
nTries = 0
|
269
|
-
bSuccess = false
|
270
|
-
parsed = nil
|
271
|
-
sError = ""
|
272
|
-
while (nTries < 5 && bSuccess == false)
|
273
|
-
begin
|
274
|
-
nTries = nTries + 1
|
275
|
-
url = "#{BlackStack::Pampa::api_protocol}://#{self.ws_url}:#{self.ws_port}/api1.3/pampa/boterror.json"
|
276
|
-
res = BlackStack::Netting::call_post(url, # TODO: migrar a RestClient para poder hacer file upload
|
277
|
-
'api_key' => BlackStack::Pampa::api_key,
|
278
|
-
'id_lnuser' => uid,
|
279
|
-
'id_object' => oid,
|
280
|
-
'worker_name' => PROCESS.fullWorkerName,
|
281
|
-
'process' => PROCESS.worker.assigned_process,
|
282
|
-
'description' => description,
|
283
|
-
'screenshot' => file,
|
284
|
-
)
|
285
|
-
parsed = JSON.parse(res.body)
|
286
|
-
if (parsed['status']=='success')
|
287
|
-
bSuccess = true
|
288
|
-
else
|
289
|
-
sError = parsed['status']
|
290
|
-
end
|
291
|
-
rescue Errno::ECONNREFUSED => e
|
292
|
-
sError = "Errno::ECONNREFUSED:" + e.to_console
|
293
|
-
rescue => e2
|
294
|
-
sError = "Exception:" + e2.to_console
|
295
|
-
end
|
296
|
-
end # while
|
297
|
-
|
298
|
-
if (bSuccess==false)
|
299
|
-
raise "#{sError}"
|
300
|
-
end
|
301
|
-
end
|
302
|
-
|
303
|
-
#
|
304
|
-
def isLnUserAvailable(id_lnuser, need_sales_navigator=false, workflow_name='incrawl.lnsearchvariation')
|
305
|
-
nTries = 0
|
306
|
-
parsed = nil
|
307
|
-
bSuccess = false
|
308
|
-
sError = ""
|
309
|
-
ret = false
|
310
|
-
|
311
|
-
while (nTries < 5 && bSuccess == false)
|
312
|
-
begin
|
313
|
-
nTries = nTries + 1
|
314
|
-
url = "#{BlackStack::Pampa::api_protocol}://#{self.ws_url}:#{self.ws_port}/api1.3/pampa/#{workflow_name}/is_lnuser_available.json"
|
315
|
-
res = BlackStack::Netting::call_post(url,
|
316
|
-
{'api_key' => BlackStack::Pampa::api_key,
|
317
|
-
'id_lnuser' => id_lnuser,
|
318
|
-
'need_sales_navigator' => need_sales_navigator,}
|
319
|
-
)
|
320
|
-
parsed = JSON.parse(res.body)
|
321
|
-
|
322
|
-
if (parsed['status']=='success')
|
323
|
-
bSuccess = true
|
324
|
-
ret = parsed['value']
|
325
|
-
else
|
326
|
-
sError = parsed['status']
|
327
|
-
end
|
328
|
-
rescue Errno::ECONNREFUSED => e
|
329
|
-
sError = "Errno::ECONNREFUSED:" + e.to_s
|
330
|
-
rescue => e2
|
331
|
-
sError = "Alghoritm Exception" + e2.to_s + '\r\n' + e2.backtrace.join("\r\n").to_s
|
332
|
-
end
|
333
|
-
end # while
|
334
|
-
|
335
|
-
if (bSuccess==false)
|
336
|
-
raise "#{sError}"
|
337
|
-
end
|
338
|
-
|
339
|
-
return ret
|
340
|
-
end # isLnUserAvailable
|
341
|
-
|
342
|
-
# TODO: deprecated
|
343
|
-
def releaseLnUser(id_lnuser, workflow_name='incrawl.lnsearchvariation')
|
344
|
-
=begin
|
345
|
-
nTries = 0
|
346
|
-
parsed = nil
|
347
|
-
bSuccess = false
|
348
|
-
sError = ""
|
349
|
-
ret = false
|
350
|
-
|
351
|
-
while (nTries < 5 && bSuccess == false)
|
352
|
-
begin
|
353
|
-
nTries = nTries + 1
|
354
|
-
url = "#{BlackStack::Pampa::api_protocol}://#{self.ws_url}:#{self.ws_port}/api1.3/pampa/#{workflow_name}/release_lnuser.json"
|
355
|
-
res = BlackStack::Netting::call_post(url,
|
356
|
-
{'api_key' => BlackStack::Pampa::api_key, 'id_lnuser' => id_lnuser,}
|
357
|
-
)
|
358
|
-
parsed = JSON.parse(res.body)
|
359
|
-
|
360
|
-
if (parsed['status']=='success')
|
361
|
-
bSuccess = true
|
362
|
-
ret = parsed['value']
|
363
|
-
else
|
364
|
-
sError = parsed['status']
|
365
|
-
end
|
366
|
-
rescue Errno::ECONNREFUSED => e
|
367
|
-
sError = "Errno::ECONNREFUSED:" + e.to_console
|
368
|
-
rescue => e2
|
369
|
-
sError = "Exception:" + e2.to_console
|
370
|
-
end
|
371
|
-
end # while
|
372
|
-
|
373
|
-
if (bSuccess==false)
|
374
|
-
raise "#{sError}"
|
375
|
-
end
|
376
|
-
|
377
|
-
return ret
|
378
|
-
=end
|
379
|
-
end # isLnUserAvailable
|
380
|
-
|
381
|
-
end # class MyBotProcess
|
382
|
-
|
383
|
-
end # module BlackStack
|