fbchat-dev / fbchat-dev/fbchat

Client.isLoggedIn() raises "AttributeError: 'NoneType' object has no attribute 'is_logged_in'"

Open
#568 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
1.2k
Forks
403
PR merge metrics
No merged PRs in 30d

Description

## Description of the problem
Client.isLoggedIn() raises ```AttributeError: 'NoneType' object has no attribute 'is_logged_in'``` referring to the Client._state property.

## Code to reproduce
```import fbchat as fb
client = fb.Client('mymail@mail.com', 'mypassword')
client.logout()
print('Logged status: {}'.format(client.isLoggedIn()))
```

## Traceback
```
AttributeError Traceback (most recent call last)
in
----> 1 client.isLoggedIn()

~/.virtualenvs/fbchat/lib/python3.8/site-packages/fbchat/_client.py in isLoggedIn(self)
152 bool: True if the client is still logged in
153 """
--> 154 return self._state.is_logged_in()
155
156 def getSession(self):

AttributeError: 'NoneType' object has no attribute 'is_logged_in'

```

## Environment information
- Python 3.8
- fbchat 1.9.6

I think in _client.py we should change in line 154 ```return self._state.is_logged_in()``` with ```return bool(self._state)```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.