I am using fastapi and when I send post with following code, it return below error:
{'detail': [{'loc': ['body'], 'msg': 'value is not a valid dict', 'type': 'type_error.dict'}]}
My code is :
import requests
import json
import datetime
def main():
time = datetime.datetime.now().isoformat()
transaction = {
"time": time,
"sender": "COCOCOCO",
"receiver": "AAAAAA",
"amount": AAA,
"description": "Christmas Dinner Fee",
"signature": "signature_sample"
}
url ="https://XXXXXX.deta.dev/transaction_pool/"
res = requests.post(url, json.dumps(transaction))
print(res.json())
if __name__ == "__main__":
main()
How do I fix it?