None TypeError when reposting a tweet #60

Open
opened 2019-06-10 09:49:22 +00:00 by b3yond · 1 comment
Owner

Author: @b3yond Posted at: 27.10.2018 10:33

Expected behavior
The twitterbot should retweet a tweet without errors.

Actual Behavior
The twitterbot retweeted the tweet 5 minutes after it got posted, but also crashed with following TypeError:

Traceback (most recent call last):
  File "backend.py", line 40, in <module>
    bot2.post(user, status)
  File "/srv/ticketfrei/active_bots/twitterbot.py", line 75, in post
    api = self.get_api(user)
  File "/srv/ticketfrei/active_bots/twitterbot.py", line 18, in get_api
    keys = user.get_twitter_credentials()
  File "/srv/ticketfrei/user.py", line 285, in get_twitter_credentials
    keys.append(row[0])
TypeError: 'NoneType' object is not subscriptable

It throws the error because row is None. row is returned by user.get_twitter_token(). I reproduced the SQL request which is executed there; it does not return None, it returns the row with two items, like it's expected.

To Reproduce

  1. Mention the bot on twitter with a matching triggerword.
  2. wait until it gets retweeted
  3. Look at the error in /var/log/ticketfrei/backend.log
Author: @b3yond Posted at: 27.10.2018 10:33 **Expected behavior** The twitterbot should retweet a tweet without errors. **Actual Behavior** The twitterbot retweeted the tweet 5 minutes after it got posted, but also crashed with following TypeError: ``` Traceback (most recent call last): File "backend.py", line 40, in <module> bot2.post(user, status) File "/srv/ticketfrei/active_bots/twitterbot.py", line 75, in post api = self.get_api(user) File "/srv/ticketfrei/active_bots/twitterbot.py", line 18, in get_api keys = user.get_twitter_credentials() File "/srv/ticketfrei/user.py", line 285, in get_twitter_credentials keys.append(row[0]) TypeError: 'NoneType' object is not subscriptable ``` It throws the error because row is None. row is returned by user.get_twitter_token(). I reproduced the SQL request which is executed there; it does not return None, it returns the row with two items, like it's expected. **To Reproduce** 1. Mention the bot on twitter with a matching triggerword. 2. wait until it gets retweeted 3. Look at the error in /var/log/ticketfrei/backend.log
b3yond added the
bug
label 2019-06-10 09:49:22 +00:00
Author
Owner

Author: @b3yond Posted at: 27.10.2018 10:34

Even weirder - it still retweeted the tweet, even though it crashed.

Author: @b3yond Posted at: 27.10.2018 10:34 Even weirder - it still retweeted the tweet, even though it crashed.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: b3yond/ticketfrei#60
No description provided.