Skip to content
This repository has been archived by the owner on Jan 1, 2023. It is now read-only.

AttributeError: 'NoneType' object has no attribute 'encode' #24

Open
ducnguyen6 opened this issue Dec 7, 2021 · 0 comments
Open

AttributeError: 'NoneType' object has no attribute 'encode' #24

ducnguyen6 opened this issue Dec 7, 2021 · 0 comments

Comments

@ducnguyen6
Copy link

I cannot login as api and secret key


In [3]: client = ftx.FtxClient("xxx", "xxx")

In [4]: client.get_balances()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-12-84f4855be095> in <module>
----> 1 client.get_balances()

~/opt/anaconda3/lib/python3.7/site-packages/ftx/api.py in wrapped(self, *args, **kwargs)
     69                 raise TypeError("You must be authenticated to use this method")
     70             else:
---> 71                 return fn(self, *args, **kwargs)
     72         return wrapped
     73 

~/opt/anaconda3/lib/python3.7/site-packages/ftx/api.py in get_balances(self)
    164     @authentication_required
    165     def get_balances(self) -> List[dict]:
--> 166         return self._get(f'wallet/balances')
    167 
    168     @authentication_required

~/opt/anaconda3/lib/python3.7/site-packages/ftx/api.py in _get(self, path, params)
     18 
     19     def _get(self, path: str, params: Optional[Dict[str, Any]] = None) -> Any:
---> 20         return self._request('GET', path, params=params)
     21 
     22     def _post(self, path: str, params: Optional[Dict[str, Any]] = None) -> Any:

~/opt/anaconda3/lib/python3.7/site-packages/ftx/api.py in _request(self, method, path, **kwargs)
     29         request = Request(method, self._base_url + path, **kwargs)
     30         if self._api_key:
---> 31             self._sign_request(request)
     32         response = self._session.send(request.prepare())
     33 

~/opt/anaconda3/lib/python3.7/site-packages/ftx/api.py in _sign_request(self, request)
     40         if prepared.body:
     41             signature_payload += prepared.body
---> 42         signature = hmac.new(self._api_secret.encode(), signature_payload, 'sha256').hexdigest()
     43         request.headers['FTX-KEY'] = self._api_key
     44         request.headers['FTX-SIGN'] = signature

AttributeError: 'NoneType' object has no attribute 'encode'
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant