Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
silkaj
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
clients
python
silkaj
Commits
56d44193
Commit
56d44193
authored
5 years ago
by
Moul
Browse files
Options
Downloads
Patches
Plain Diff
[enh]
#189
: Handle wot/lookup call exceptions:
- Rename f() to wot_lookup() - Remove no longer used constant
parent
953c3529
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
silkaj/constants.py
+0
-1
0 additions, 1 deletion
silkaj/constants.py
silkaj/wot.py
+17
-21
17 additions, 21 deletions
silkaj/wot.py
with
17 additions
and
22 deletions
silkaj/constants.py
+
0
−
1
View file @
56d44193
...
...
@@ -16,7 +16,6 @@ along with Silkaj. If not, see <https://www.gnu.org/licenses/>.
"""
SILKAJ_VERSION
=
"
0.6.0
"
NO_MATCHING_ID
=
"
No matching identity
"
G1_SYMBOL
=
"
Ğ1
"
GTEST_SYMBOL
=
"
ĞTest
"
G1_DEFAULT_ENDPOINT
=
"
g1.duniter.org
"
,
"
443
"
...
...
This diff is collapsed.
Click to expand it.
silkaj/wot.py
+
17
−
21
View file @
56d44193
...
...
@@ -26,7 +26,6 @@ from silkaj.network_tools import ClientInstance
from
silkaj.crypto_tools
import
check_public_key
from
silkaj.tools
import
message_exit
,
convert_time
,
coroutine
from
silkaj.blockchain_tools
import
BlockchainParams
from
silkaj.constants
import
NO_MATCHING_ID
def
get_sent_certifications
(
certs
,
time_first_block
,
params
):
...
...
@@ -166,18 +165,15 @@ async def id_pubkey_correspondence(id_pubkey):
)
)
else
:
pubkeys
=
await
get_informations_for_identities
(
id_pubkey
)
if
pubkeys
==
NO_MATCHING_ID
:
print
(
NO_MATCHING_ID
)
else
:
print
(
"
Public keys found matching
'
{}
'
:
\n
"
.
format
(
id_pubkey
))
for
pubkey
in
pubkeys
:
print
(
"
→
"
,
pubkey
[
"
pubkey
"
],
end
=
"
"
)
try
:
corresponding_id
=
await
client
(
wot
.
identity_of
,
pubkey
[
"
pubkey
"
])
print
(
"
↔
"
+
corresponding_id
[
"
uid
"
])
except
:
print
(
""
)
pubkeys
=
await
wot_lookup
(
id_pubkey
)
print
(
"
Public keys found matching
'
{}
'
:
\n
"
.
format
(
id_pubkey
))
for
pubkey
in
pubkeys
:
print
(
"
→
"
,
pubkey
[
"
pubkey
"
],
end
=
"
"
)
try
:
corresponding_id
=
await
client
(
wot
.
identity_of
,
pubkey
[
"
pubkey
"
])
print
(
"
↔
"
+
corresponding_id
[
"
uid
"
])
except
:
print
(
""
)
await
client
.
close
()
...
...
@@ -187,13 +183,11 @@ async def get_informations_for_identity(id):
many identities could match
return the one searched
"""
certs_req
=
await
get_informations_for_identities
(
id
)
if
certs_req
==
NO_MATCHING_ID
:
message_exit
(
NO_MATCHING_ID
)
certs_req
=
await
wot_lookup
(
id
)
for
certs_id
in
certs_req
:
if
certs_id
[
"
uids
"
][
0
][
"
uid
"
].
lower
()
==
id
.
lower
():
return
certs_id
message_exit
(
NO_MATCHING_ID
)
message_exit
(
"
No matching identity
"
)
async
def
identity_of
(
pubkey_uid
):
...
...
@@ -222,7 +216,7 @@ async def is_member(pubkey_uid):
return
False
async
def
get_informations_for_identities
(
identifier
):
async
def
wot_lookup
(
identifier
):
"""
:identifier: identity or pubkey in part or whole
Return received and sent certifications lists of matching identities
...
...
@@ -231,6 +225,8 @@ async def get_informations_for_identities(identifier):
client
=
ClientInstance
().
client
try
:
results
=
await
client
(
wot
.
lookup
,
identifier
)
except
:
return
NO_MATCHING_ID
return
results
[
"
results
"
]
return
results
[
"
results
"
]
except
DuniterError
as
e
:
message_exit
(
e
.
message
)
except
ValueError
as
e
:
pass
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