diff --git a/src/wot.py b/src/wot.py index 6e3ccaf11c0598ca9710f61426748a3388fc12a9..c2325607d123d36fc6faa2e1f948954e53c51d9a 100644 --- a/src/wot.py +++ b/src/wot.py @@ -25,17 +25,22 @@ def received_sent_certifications(ep, id): """ if get_pubkeys_from_id(ep, id) == NO_MATCHING_ID: message_exit(NO_MATCHING_ID) - certs_req = get_request(ep, "wot/lookup/" + id)["results"][0] + certs_req = get_request(ep, "wot/lookup/" + id)["results"] + for certs_id in certs_req: + print(certs_id['uids'][0]['uid'], id) + if certs_id['uids'][0]['uid'].lower() == id.lower(): + id_certs = certs_id + break certifications = OrderedDict() os.system("clear") - for certs in certs_req["uids"]: + for certs in id_certs["uids"]: if certs["uid"].lower() == id.lower(): certifications["received"] = list() for cert in certs["others"]: certifications["received"].append(cert["uids"][0]) - certifications["sent"] = get_sent_certifications(certs_req) + certifications["sent"] = get_sent_certifications(id_certs) print("{0} ({1}) from block #{2}\nreceived {3} and sent {4} certifications:\n{5}\n" - .format(id, certs_req["pubkey"][:5] + "…", certs["meta"]["timestamp"][:15] + "…", + .format(id, id_certs["pubkey"][:5] + "…", certs["meta"]["timestamp"][:15] + "…", len(certifications["received"]), len(certifications["sent"]), tabulate(certifications, headers="keys", tablefmt="orgtbl", stralign="center")))