Skip to content

Websocket: Attempt to decode JSON with unexpected mimetype: text/plain; charset=utf-8 #2

Description

@wjmelements

I am trying to use a websocket uri for the sdk. Maybe it's not supported, but here is the error. I did not see the error when using http.

Version 0.0.4.

Traceback (most recent call last):
  File "~/.local/share/virtualenvs/prj-XTuW3tpY/lib/python3.7/site-packages/defisdk/repositories/ethereum.py", line 24, in call_method
    node_answer = await self._post(url=self.url.url, headers=headers, data=data)
  File "~/.local/share/virtualenvs/prj-XTuW3tpY/lib/python3.7/site-packages/defisdk/repositories/base.py", line 18, in _post
    return await r.json()
  File "~/.local/share/virtualenvs/prj-XTuW3tpY/lib/python3.7/site-packages/aiohttp/client_reqrep.py", line 1103, in json
    headers=self.headers,
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/plain; charset=utf-8', url=URL('ws://192.168.0.15:8546')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "~/.local/share/virtualenvs/prj-XTuW3tpY/lib/python3.7/site-packages/defisdk/repositories/ethereum.py", line 26, in call_method
    raise EthereumNodeResponseException(params, e.message, e.code, e.response)
AttributeError: 'ContentTypeError' object has no attribute 'response'

During handling of the above exception, another exception occurred:
    
    ...

     = await defi_sdk.get_token_components(
  File "~/.local/share/virtualenvs/prj-XTuW3tpY/lib/python3.7/site-packages/defisdk/__init__.py", line 84, in get_token_components
    return await self._repository.get_token_components(token_type, token_address, block)
  File "~/.local/share/virtualenvs/prj-XTuW3tpY/lib/python3.7/site-packages/defisdk/repositories/defi.py", line 187, in get_token_components
    full_token_balance = await self.get_full_token_balance(token_type, token_address, block)
  File "~/.local/share/virtualenvs/prj-XTuW3tpY/lib/python3.7/site-packages/defisdk/repositories/defi.py", line 159, in get_full_token_balance
    block=block
  File "~/.local/share/virtualenvs/prj-XTuW3tpY/lib/python3.7/site-packages/defisdk/repositories/ethereum.py", line 42, in _call
    node_answer = await self.call_method('eth_call', params)
  File "~/.local/share/virtualenvs/prj-XTuW3tpY/lib/python3.7/site-packages/defisdk/repositories/ethereum.py", line 28, in call_method
    if not node_answer.get('result'):
AttributeError: 'NoneType' object has no attribute 'get'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions