Commit 8caa8e23 authored by Moul's avatar Moul
Browse files

[enh] #7: id: Use DuniterPy

parent c7bcdb80
......@@ -187,7 +187,7 @@ async def manage_cmd():
generate_auth_file(cli_args)
elif cli_args.subcmd == "id" or cli_args.subcmd == "identities":
id_pubkey_correspondence(cli_args.subsubcmd)
await id_pubkey_correspondence(cli_args.subsubcmd)
elif cli_args.subcmd == "wot":
await received_sent_certifications(cli_args.subsubcmd)
......
......@@ -144,7 +144,8 @@ def date_approximation(block_id, time_first_block, avgentime):
return time_first_block + block_id * avgentime
def id_pubkey_correspondence(id_pubkey):
async def id_pubkey_correspondence(id_pubkey):
client = ClientInstance().client
if check_public_key(id_pubkey, False):
print(
"{} public key corresponds to identity: {}".format(
......@@ -152,7 +153,7 @@ def id_pubkey_correspondence(id_pubkey):
)
)
else:
pubkeys = get_informations_for_identities(id_pubkey)
pubkeys = await get_informations_for_identities(id_pubkey)
if pubkeys == NO_MATCHING_ID:
print(NO_MATCHING_ID)
else:
......@@ -160,11 +161,11 @@ def id_pubkey_correspondence(id_pubkey):
for pubkey in pubkeys:
print("→", pubkey["pubkey"], end=" ")
try:
print(
"↔ " + get_request("wot/identity-of/" + pubkey["pubkey"])["uid"]
)
corresponding_id = await client(wot.identity_of, pubkey["pubkey"])
print("↔ " + corresponding_id["uid"])
except:
print("")
await client.close()
async def get_informations_for_identity(id):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment