argument of type 'NoneType' is not iterable POST запросы
@app.route('/transactions/new', methods=['POST'])
def GVO_new_transaction():
values = request.get_json()
required = ['sender', 'recipient', 'amount']
if not all(k in values for k in required):
return 'Missing values', 400
index = blockchain.GVO_new_transaction(values['sender'], values['recipient'], values['amount'])
response = {'message': f'Transaction will be added to Block {index}'}
return jsonify(response), 201
Ответы (1 шт):
Автор решения: CrazyElf
→ Ссылка
Поскольку в required у вас точно список есть, остаётся только вариант, что у вас в values лежит None. Значит request.get_json() выдаёт None. Видимо, в запросе JSON отсутствует.
