sammchardy / python-binance-chain

Binance Chain Exchange API python implementation for automated trading
http://python-binance-chain.rtfd.io
MIT License
297 stars 133 forks source link

KeyError: 'message' in using signing service for signing a transferMsg #41

Open Mahsa-Bastankhah opened 3 years ago

Mahsa-Bastankhah commented 3 years ago

Hi. I'm running the following code : signing_client = HttpApiSigningClient('http://127.0.0.1:8000', username='sam', password='mypass') client = HttpApiClient(env=testnet_env) transfer_msg = TransferMsg( symbol='BNB', amount=1, to_address='tbnb15lq6x48g3pvaqjwhqfg4nygx63q03zsvk9rlxs') signed_msg = signing_client.sign_transfer(transfer_msg, wallet_name='wallet_3') res = signing_client.broadcast_transfer(signed_msg, wallet_name="wallet_3")

and I get this error raised from signed_msg = signing_client.sign_transfer(transfer_msg, wallet_name='wallet_3') :

"File "sendBNB.py", line 23, in signed_msg = signing_client.sign_transfer(transfer_msg, wallet_name='wallet_3') File "/home/mahsa/.local/lib/python3.6/site-packages/binance_chain/signing/http.py", line 266, in sign_transfer return self._post('transfer/sign', json=data) File "/home/mahsa/.local/lib/python3.6/site-packages/binance_chain/signing/http.py", line 122, in _post return self._request('post', path, **kwargs) File "/home/mahsa/.local/lib/python3.6/site-packages/binance_chain/signing/http.py", line 93, in _request return self._handle_response(response) File "/home/mahsa/.local/lib/python3.6/site-packages/binance_chain/signing/http.py", line 104, in _handle_response raise BinanceChainAPIException(response, response.status_code) File "/home/mahsa/.local/lib/python3.6/site-packages/binance_chain/exceptions.py", line 17, in init self.message = json_res['message'] KeyError: 'message'"

my uvicorn server also prints : INFO: 127.0.0.1:46392 - "POST /api/auth/login HTTP/1.1" 200 OK INFO: 127.0.0.1:46394 - "POST /api/auth/login HTTP/1.1" 200 OK INFO: 127.0.0.1:46394 - "POST /api/transfer/broadcast HTTP/1.1" 422 Unprocessable Entity

the weird fact is that when I use signing service for NewOrderMsg it works without any problem! what should I do?