Rewrite twitter-bot in python3 with tweepy #7

Closed
opened 2019-06-10 09:48:15 +00:00 by b3yond · 3 comments
Owner

Author: @b3yond Posted at: 29.12.2017 17:44

Tweepy is a twitter library for python3: http://tweepy.readthedocs.io/en/v3.5.0/getting_started.html#introduction

as the mastodon bot is already in python3, this enables more code consistency & modularity.

Author: @b3yond Posted at: 29.12.2017 17:44 Tweepy is a twitter library for python3: http://tweepy.readthedocs.io/en/v3.5.0/getting_started.html#introduction as the mastodon bot is already in python3, this enables more code consistency & modularity.
Author
Owner

Author: @b3yond Posted at: 29.12.2017 19:01

so far done, but not committed:

  • changed auth mechanism to tweepy
  • changed shutdown handling to tweepy
  • changed print statements to python3
  • find a way to crawl mentions with tweepy
  • retweet with tweepy
  • post mastodon statuses with tweepy
  • changed error handling to tweepy
  • maybe other stuff I didn't find yet
  • test
Author: @b3yond Posted at: 29.12.2017 19:01 so far done, but not committed: * [x] changed auth mechanism to tweepy * [x] changed shutdown handling to tweepy * [x] changed print statements to python3 * [x] find a way to crawl mentions with tweepy * [x] retweet with tweepy * [x] post mastodon statuses with tweepy * [x] changed error handling to tweepy * [ ] maybe other stuff I didn't find yet * [x] test
Author
Owner

Author: @b3yond Posted at: 30.12.2017 09:34

the mastodon bot still has issues. Since it was also transfered from python2 -> python3, there is an error with pickle.dump:

Path of logfile: logs/2017-12-30 10:32:43.723493
Traceback (most recent call last):
  File "ticketfrei.py", line 30, in <module>
    statuses = mbot.retoot(statuses)
  File "/home/ticketfrei/ticketfrei/retootbot.py", line 105, in retoot
    pickle.dump(self.seen_toots, f)
TypeError: write() argument must be str, not bytes

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "ticketfrei.py", line 36, in <module>
    tbot.log(traceback.extract_tb(sys.exc_info()[2]))
  File "/home/ticketfrei/ticketfrei/retweetbot.py", line 96, in log
    line = "[" + time + "] " + message + "\n"
TypeError: Can't convert 'StackSummary' object to str implicitly
Author: @b3yond Posted at: 30.12.2017 09:34 the mastodon bot still has issues. Since it was also transfered from python2 -> python3, there is an error with pickle.dump: ``` Path of logfile: logs/2017-12-30 10:32:43.723493 Traceback (most recent call last): File "ticketfrei.py", line 30, in <module> statuses = mbot.retoot(statuses) File "/home/ticketfrei/ticketfrei/retootbot.py", line 105, in retoot pickle.dump(self.seen_toots, f) TypeError: write() argument must be str, not bytes During handling of the above exception, another exception occurred: Traceback (most recent call last): File "ticketfrei.py", line 36, in <module> tbot.log(traceback.extract_tb(sys.exc_info()[2])) File "/home/ticketfrei/ticketfrei/retweetbot.py", line 96, in log line = "[" + time + "] " + message + "\n" TypeError: Can't convert 'StackSummary' object to str implicitly ```
Author
Owner

Author: @b3yond Posted at: 30.12.2017 13:07

okay, tom fixed it.

Author: @b3yond Posted at: 30.12.2017 13:07 okay, tom fixed it.
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#7
No description provided.