Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
beem
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
beem
Commits
8ff81359
Commit
8ff81359
authored
6 years ago
by
crokkon
Browse files
Options
Downloads
Patches
Plain Diff
graphenerpc: decouple RPC method from dict keys
parent
32f44334
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
beemapi/graphenerpc.py
+9
-4
9 additions, 4 deletions
beemapi/graphenerpc.py
with
9 additions
and
4 deletions
beemapi/graphenerpc.py
+
9
−
4
View file @
8ff81359
...
...
@@ -173,7 +173,7 @@ class GrapheneRPC(object):
def
is_appbase_ready
(
self
):
"""
Check if node is appbase ready
"""
return
self
.
current_rpc
>=
2
return
self
.
current_rpc
in
[
self
.
rpc_methods
[
'
wsappbase
'
],
self
.
rpc_methods
[
'
appbase
'
]]
def
get_use_appbase
(
self
):
"""
Returns True if appbase ready and appbase calls are set
"""
...
...
@@ -212,7 +212,11 @@ class GrapheneRPC(object):
props
=
self
.
get_config
()
except
Exception
as
e
:
if
re
.
search
(
"
Bad Cast:Invalid cast from type
"
,
str
(
e
)):
self
.
current_rpc
+=
2
# retry with appbase
if
self
.
current_rpc
==
self
.
rpc_methods
[
'
ws
'
]:
self
.
current_rpc
=
self
.
rpc_methods
[
'
wsappbase
'
]
else
:
self
.
current_rpc
=
self
.
rpc_methods
[
'
appbase
'
]
props
=
self
.
get_config
(
api
=
"
database
"
)
if
props
is
None
:
raise
RPCError
(
"
Could not recieve answer for get_config
"
)
...
...
@@ -232,7 +236,7 @@ class GrapheneRPC(object):
def
rpclogin
(
self
,
user
,
password
):
"""
Login into Websocket
"""
if
self
.
ws
and
self
.
current_rpc
==
0
and
user
and
password
:
if
self
.
ws
and
self
.
current_rpc
==
self
.
rpc_methods
[
'
ws
'
]
and
user
and
password
:
self
.
login
(
user
,
password
,
api
=
"
login_api
"
)
def
rpcclose
(
self
):
...
...
@@ -329,7 +333,8 @@ class GrapheneRPC(object):
while
True
:
self
.
nodes
.
increase_error_cnt_call
()
try
:
if
self
.
current_rpc
==
0
or
self
.
current_rpc
==
2
:
if
self
.
current_rpc
==
self
.
rpc_methods
[
'
ws
'
]
or
\
self
.
current_rpc
==
self
.
rpc_methods
[
'
wsappbase
'
]:
reply
=
self
.
ws_send
(
json
.
dumps
(
payload
,
ensure_ascii
=
False
).
encode
(
'
utf8
'
))
else
:
reply
=
self
.
request_send
(
json
.
dumps
(
payload
,
ensure_ascii
=
False
).
encode
(
'
utf8
'
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment