2014-09-26 4 views
1

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) 역 추적 내부 서버 오류는 다음과 같다 렌더링?

+0

이것은 braintree 코드에 있습니다. 따라서 GAE가 아니라 관련 있다고 말할 수 있습니다. GAE와 함께 작동하도록 테스트를 받았습니까? GAE의 샌드 박스 모델에서 허용되지 않는 작업을하려고합니까? – Mario

+0

동일한 스크립트를 내 컴퓨터에서 로컬로 테스트 한 결과 작동했습니다. 나는 단순히 신용 카드 정보를 보내서 거래를 POST하려고하기 때문에 허락되지 않은 일을하려고하지 않는다고 생각합니다. 내 경우에는 가짜 것입니다. 그래서 실제로 소켓을 통해 전송되는 숫자입니다. –

+0

귀하의 코드는 @app 데코레이터를 사용합니다. 문제는 그것에서 비롯됩니다. – Mario

답변

1

저는 Braintree에서 일합니다. 도움이 더 필요하면 언제든지 get in touch with our support team 할 수 있습니다.

이것은 problem with certain versions of urllib3/requests (a Braintree dependency) on GAE 인 것으로 보입니다. 당신의 app.yaml 파일이 추가

시도 :

libraries: 
- name: ssl 
    version: latest 

그리고 당신은 청구 응용 프로그램에 대해 사용하도록 설정해야합니다.

위의 방법으로 해결할 수없는 경우 위에 링크 된 github 문제를 참조하십시오.

+0

검토해 주셔서 감사합니다. 위 링크의 문제에서 설명한대로 라이브러리를 추가하고 결제를 사용하도록 설정했습니다. 그러나 다음과 같은 오류가 있습니다 : 파일 "/home/manuel/Google/braintree_app/braintree/util/http.py"줄 71, __http_do에서 raise e ConnectionError : ('연결이 끊어졌습니다.'오류 13, 'Permission denied')) GAE에서 결제가 사용 중지되어 라이브러리에 액세스 할 수 없지만 결제가 사용 설정되어 있는지 확인할 수 있습니다. 나는 붙어있다. –

+0

@ManuelGodoy 지원 티켓에 응한 것 같지만, 다른 사람들은 읽었습니다. 답변에 링크 된 문제에서 언급했듯이 GAE의 Python에서 소켓 라이브러리를 사용하려면 대금 청구가 필요합니다. – agf

+0

내 의견에 말했듯이 결제가 사용 설정되어 있고 문제가 지속됩니다. –

관련 문제