Braintree 플랫폼을 포함하는 Google App Engine에서 테스트하고 있습니다. 가상 트랜잭션을 처리하기 위해이 코드를 사용하고 있습니다. 내 HTML에서는 양식을 제출할 때 아래 정보를 "/ create_transaction"에 전달합니다. 서버 코드는 다음과 같습니다AttributeError : Braintree를 사용하는 GAE에서 'NoneType'객체에 'wrap_socket'속성이 없습니다.
ERROR 2014-09-26 03:08:13,852 app.py:1423] Exception on /create_transaction [POST]
Traceback (most recent call last):
File "/home/manuel/Google/braintree_app/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/home/manuel/Google/braintree_app/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/manuel/Google/braintree_app/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/manuel/Google/braintree_app/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/home/manuel/Google/braintree_app/flask/app.py", line 1461, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/home/manuel/Google/braintree_app/app.py", line 40, in create_transaction
"submit_for_settlement": True
File "/home/manuel/Google/braintree_app/braintree/transaction.py", line 302, in sale
return Transaction.create(params)
File "/home/manuel/Google/braintree_app/braintree/transaction.py", line 397, in create
return Configuration.gateway().transaction.create(params)
File "/home/manuel/Google/braintree_app/braintree/transaction_gateway.py", line 33, in create
return self._post("/transactions", {"transaction": params})
File "/home/manuel/Google/braintree_app/braintree/transaction_gateway.py", line 137, in _post
response = self.config.http().post(url, params)
File "/home/manuel/Google/braintree_app/braintree/util/http.py", line 49, in post
return self.__http_do("POST", path, params)
File "/home/manuel/Google/braintree_app/braintree/util/http.py", line 71, in __http_do
raise e
AttributeError: 'NoneType' object has no attribute 'wrap_socket'
왜 GAE이 예외를 던지고있다 :
@app.route("/create_transaction", methods=["POST"])
def create_transaction():
result = braintree.Transaction.sale({
"amount": "1000.00",
"credit_card": {
"number": request.form["number"],
"cvv": request.form["cvv"],
"expiration_month": request.form["month"],
"expiration_year": request.form["year"]
},
"options": {
"submit_for_settlement": True
}
})
if result.is_success:
return "<h1>Success! Transaction ID: {0}</h1>".format(result.transaction.id)
else:
return "<h1>Error: {0}</h1>".format(result.message)
대신, 그 결과를 돌려줍니다 브라우저 (500) 역 추적 내부 서버 오류는 다음과 같다 렌더링?
이것은 braintree 코드에 있습니다. 따라서 GAE가 아니라 관련 있다고 말할 수 있습니다. GAE와 함께 작동하도록 테스트를 받았습니까? GAE의 샌드 박스 모델에서 허용되지 않는 작업을하려고합니까? – Mario
동일한 스크립트를 내 컴퓨터에서 로컬로 테스트 한 결과 작동했습니다. 나는 단순히 신용 카드 정보를 보내서 거래를 POST하려고하기 때문에 허락되지 않은 일을하려고하지 않는다고 생각합니다. 내 경우에는 가짜 것입니다. 그래서 실제로 소켓을 통해 전송되는 숫자입니다. –
귀하의 코드는 @app 데코레이터를 사용합니다. 문제는 그것에서 비롯됩니다. – Mario