Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
J
jussi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
jussi
Commits
6e3bafce
Unverified
Commit
6e3bafce
authored
6 years ago
by
Justin Welch
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #187 from steemit/route-getstate-witnesses
route get_state witnesses
parents
431bd3cb
273b9dec
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
jussi/upstream.py
+11
-9
11 additions, 9 deletions
jussi/upstream.py
with
11 additions
and
9 deletions
jussi/upstream.py
+
11
−
9
View file @
6e3bafce
...
...
@@ -18,7 +18,7 @@ from .errors import InvalidUpstreamURL
logger
=
structlog
.
get_logger
(
__name__
)
ACCOUNT_TRANSFER_PATTERN
=
re
.
compile
(
r
'
^\/?@([^\/\s]+)/transfers$
'
)
ACCOUNT_TRANSFER_PATTERN
=
re
.
compile
(
r
'
^\/?
(
@([^\/\s]+)/transfers
|~?witnesses)
$
'
)
# -------------------
...
...
@@ -88,14 +88,16 @@ class _Upstreams(object):
@functools.lru_cache
(
8192
)
def
url
(
self
,
request_urn
)
->
str
:
try
:
if
(
request_urn
.
api
==
'
database_api
'
or
request_urn
.
api
==
'
condenser_api
'
)
and
ACCOUNT_TRANSFER_PATTERN
.
match
(
request_urn
.
params
[
0
]):
url
=
os
.
environ
.
get
(
'
JUSSI_ACCOUNT_TRANSFER_STEEMD_URL
'
)
if
url
:
return
url
except
Exception
:
pass
# certain steemd.get_state paths must be routed differently
if
(
request_urn
.
api
in
[
'
database_api
'
,
'
condenser_api
'
]
and
request_urn
.
method
==
'
get_state
'
and
isinstance
(
request_urn
.
params
,
list
)
and
len
(
request_urn
.
params
)
==
1
and
ACCOUNT_TRANSFER_PATTERN
.
match
(
request_urn
.
params
[
0
])):
url
=
os
.
environ
.
get
(
'
JUSSI_ACCOUNT_TRANSFER_STEEMD_URL
'
)
if
url
:
return
url
_
,
url
=
self
.
__URLS
.
longest_prefix
(
str
(
request_urn
))
if
not
url
:
raise
InvalidUpstreamURL
(
...
...
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