首页 > 解决方案 > 如何使用贝宝修复删除深度复制错误?Python

问题描述

        body = {
        "sender_batch_header": {
            "recipient_type": "EMAIL",
            "email_message": "SDK payouts test txn",
            "note": "Enjoy your Payout!!",
            "sender_batch_id": "Test_SDK_1",
            "email_subject": "This is a test transaction from SDK"
        },
        "items": [{
            "note": "Your " + str(form.nbr_athena.data) + "€ Payout!",
            "amount": {
                "currency": "EUR",
                "value": str(form.nbr_athena.data)
            },
            "receiver": str(form.email_paypal.data),
            "sender_item_id": "Test_txn_5"
        }]
    }
    request_paypal = PayoutsPostRequest()
    request_paypal.request_body(body)
    # Call API with your client and get a response for your call
    response = sdk_paypal_client.execute(request)
    # If call returns body in response, you can get the deserialized version from the result attribute of the response
    batch_id = response.result.batch_header.payout_batch_id
    print(batch_id)
    print(response)
    flash("votre monnaie à bien était envoyé !!", "success")
    payment.status = Status.Success.value
    db.session.add(payment)
    db.session.commit()

我试图在我的网站上集成 paypal sdk,但是当使用此行发送请求时,response = sdk_paypal_client.execute (request) 我收到一个深拷贝错误

TypeError: cannot serialize '_io.BufferedReader' object我尝试对我的请求进行字符串化,但这并不好

标签: pythonflaskpaypalsdk

解决方案


推荐阅读