def createnewwallet(request):
data = {}
mykey = RSA.generate(1024)
public_key = mykey.publickey().exportKey('PEM')
private_key = mykey.exportKey('PEM')
wallet_id = hashlib.sha256(public_key).hexdigest()
data["public_key"] = public_key
data["private_key"] = private_key
data["wallet_id"] = wallet_id
return HttpResponse(json.dumps(data), content_type="application/json")
当我去了这个代码我得到了这个警报;
File "/opt/venv/cloudbank/cloudbank/views.py", line 41
return HttpResponse(json.dumps(data), content_type="application/json")
^
IndentationError: unexpected indent
任何人都可以帮助我,谢谢
答案 0 :(得分:1)
正确缩进!
def createnewwallet(request):
data = {}
mykey = RSA.generate(1024)
public_key = mykey.publickey().exportKey('PEM')
private_key = mykey.exportKey('PEM')
wallet_id = hashlib.sha256(public_key).hexdigest()
data["public_key"] = public_key
data["private_key"] = private_key
data["wallet_id"] = wallet_id
return HttpResponse(json.dumps(data), content_type="application/json")