def handle(self):
    digest = self.request.get("d")  # expects client-side hashing

    if not digest or len(digest) != 64:
      return {"success" : False, "reason" : "format"}
    try:
      digest.decode("hex")
    except __HOLE__:
      return {"success" : False, "reason" : "format"}

    ret = self.store_digest(digest)
    if not ret["success"]:
      del ret["args"]
      return ret

    doc_dict = self.doc.to_dict()
    pay_address = doc_dict.get('payment_address')
    if not pay_address:
      return {"success" : False, "reason" : "cant generate pay address"}

    ret["pay_address"] = pay_address
    ret["price"] = MIN_SATOSHIS_PAYMENT
    return ret
dataset/ETHPy150Open maraoz/proofofexistence/api.py/ExternalRegisterHandler.handle