ayush-sharma / tweet-toot

This project has moved to:
https://gitlab.com/ayush-sharma/tweet-toot
GNU Affero General Public License v3.0
12 stars 14 forks source link

COmpatibility with Raspberry pi 4 #16

Open Didou09 opened 4 years ago

Didou09 commented 4 years ago

Dear @ayush-sharma ,

I have made minor changes to branch develop just to make it compatible with low-level hardware like the rapsberry pi 4 which cannot handle python 3.7 and is limited to python 3.4. It basically means it can't handle modern string formatting :

f'blablabl {variable1} blablabla' truned into 'blablabla {} blablabla'.format(variable1)

I changed all concerned strings in all files, but that's all I changed.

Also, I merged your last changes to develop to test (see terminal log below):

Test with Eoruscipy only:

pi@raspberrypi:~/Twitter2Mastodon/tweet-toot/tweet-toot (develop) $ python run.py
2020-05-10 20:51:19,701 - __main__ - INFO - __main__ => Mode: one-to-one
2020-05-10 20:51:19,702 - tweettoot - INFO - relay() => Init relay from https://twitter.com/EuroSciPy to https://botsin.space. State file /tmp/tt_b67df4aa5c823c5c3d3c22aa28e4e1c73a86dbe5
2020-05-10 20:51:19,726 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): twitter.com
2020-05-10 20:51:21,639 - tweettoot - INFO - get_tweets() => Fetched 20 new tweets for https://twitter.com/EuroSciPy.
2020-05-10 20:51:21,989 - tweettoot - INFO - relay() => Tweeting 1230060371114954752 to https://botsin.space
2020-05-10 20:51:21,993 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): botsin.space
2020-05-10 20:51:22,622 - tweettoot - INFO - toot_the_tweet() => OK. Tooted 1230060371114954752 to https://botsin.space.
2020-05-10 20:51:22,623 - tweettoot - INFO - relay() => Tweeting 1235987701297487873 to https://botsin.space
2020-05-10 20:51:22,626 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): botsin.space
2020-05-10 20:51:23,126 - tweettoot - INFO - toot_the_tweet() => OK. Tooted 1235987701297487873 to https://botsin.space.
2020-05-10 20:51:23,129 - tweettoot - INFO - relay() => Tweeting 1231569185458790400 to https://botsin.space
2020-05-10 20:51:23,137 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): botsin.space
2020-05-10 20:51:23,668 - tweettoot - INFO - toot_the_tweet() => OK. Tooted 1231569185458790400 to https://botsin.space.
2020-05-10 20:51:23,671 - tweettoot - INFO - relay() => Tweeting 1251268988912443395 to https://botsin.space
2020-05-10 20:51:23,679 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): botsin.space
2020-05-10 20:51:24,226 - tweettoot - INFO - toot_the_tweet() => OK. Tooted 1251268988912443395 to https://botsin.space.
2020-05-10 20:51:24,228 - tweettoot - INFO - relay() => Tweeting 1234538966906527752 to https://botsin.space
2020-05-10 20:51:24,231 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): botsin.space
2020-05-10 20:51:24,743 - tweettoot - INFO - toot_the_tweet() => OK. Tooted 1234538966906527752 to https://botsin.space.
2020-05-10 20:51:24,747 - tweettoot - INFO - relay() => Tweeting 1235868034062880768 to https://botsin.space
2020-05-10 20:51:24,754 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): botsin.space
2020-05-10 20:51:25,311 - tweettoot - INFO - toot_the_tweet() => OK. Tooted 1235868034062880768 to https://botsin.space.
2020-05-10 20:51:25,314 - tweettoot - INFO - relay() => Tweeting 1235112746988875777 to https://botsin.space
2020-05-10 20:51:25,322 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): botsin.space
2020-05-10 20:51:25,899 - tweettoot - INFO - toot_the_tweet() => OK. Tooted 1235112746988875777 to https://botsin.space.
2020-05-10 20:51:25,901 - tweettoot - INFO - relay() => Tweeting 1240399282995421190 to https://botsin.space
2020-05-10 20:51:25,904 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): botsin.space
2020-05-10 20:51:26,775 - tweettoot - INFO - toot_the_tweet() => OK. Tooted 1240399282995421190 to https://botsin.space.
2020-05-10 20:51:26,779 - tweettoot - INFO - relay() => Tweeting 1253737600466276352 to https://botsin.space
2020-05-10 20:51:26,787 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): botsin.space
2020-05-10 20:51:27,314 - tweettoot - INFO - toot_the_tweet() => OK. Tooted 1253737600466276352 to https://botsin.space.
2020-05-10 20:51:27,317 - tweettoot - INFO - relay() => Tweeting 1230798932449644544 to https://botsin.space
2020-05-10 20:51:27,325 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): botsin.space
2020-05-10 20:51:27,894 - tweettoot - INFO - toot_the_tweet() => OK. Tooted 1230798932449644544 to https://botsin.space.
2020-05-10 20:51:27,897 - tweettoot - INFO - relay() => Tweeting 1234428825464909825 to https://botsin.space
2020-05-10 20:51:27,905 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): botsin.space
2020-05-10 20:51:28,476 - tweettoot - INFO - toot_the_tweet() => OK. Tooted 1234428825464909825 to https://botsin.space.

Then I tried adding a second twitter / mastodon pair of accounts following your readme: it worked :+1: . However, I feel the sane problem occured again: the order in which the toots appear on the mastodon instance is not the same as the order in which they were twitted. Any idea why ?

pi@raspberrypi:~/Twitter2Mastodon/tweet-toot/tweet-toot (develop) $ python run.py
2020-05-10 21:13:37,606 - __main__ - INFO - __main__ => Mode: one-to-one
2020-05-10 21:13:37,606 - tweettoot - INFO - relay() => Init relay from https://twitter.com/EuroSciPy to https://botsin.space. State file /tmp/tt_b67df4aa5c823c5c3d3c22aa28e4e1c73a86dbe5
2020-05-10 21:13:37,630 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): twitter.com
2020-05-10 21:13:39,631 - tweettoot - INFO - get_tweets() => Fetched 20 new tweets for https://twitter.com/EuroSciPy.
2020-05-10 21:13:39,869 - tweettoot - INFO - relay() => Init relay from https://twitter.com/CaptainFact_io to https://mamot.fr. State file /tmp/tt_737c383200799cc0854fe3efa12c6d2e9f989885
2020-05-10 21:13:39,874 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): twitter.com
2020-05-10 21:13:41,799 - tweettoot - INFO - get_tweets() => Fetched 21 new tweets for https://twitter.com/CaptainFact_io.
2020-05-10 21:13:42,252 - tweettoot - INFO - relay() => Tweeting 1256181831822708736 to https://mamot.fr
2020-05-10 21:13:42,255 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): mamot.fr
2020-05-10 21:13:43,111 - tweettoot - INFO - toot_the_tweet() => OK. Tooted 1256181831822708736 to https://mamot.fr.
2020-05-10 21:13:43,112 - tweettoot - INFO - relay() => Tweeting 1257703590640091136 to https://mamot.fr
2020-05-10 21:13:43,120 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): mamot.fr
2020-05-10 21:13:44,122 - tweettoot - INFO - toot_the_tweet() => OK. Tooted 1257703590640091136 to https://mamot.fr.
2020-05-10 21:13:44,123 - tweettoot - INFO - relay() => Tweeting 1259559146749378562 to https://mamot.fr
2020-05-10 21:13:44,131 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): mamot.fr
2020-05-10 21:13:44,796 - tweettoot - INFO - toot_the_tweet() => OK. Tooted 1259559146749378562 to https://mamot.fr.
2020-05-10 21:13:44,797 - tweettoot - INFO - relay() => Tweeting 1254336401006628870 to https://mamot.fr
2020-05-10 21:13:44,801 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): mamot.fr
2020-05-10 21:13:45,672 - tweettoot - INFO - toot_the_tweet() => OK. Tooted 1254336401006628870 to https://mamot.fr.
2020-05-10 21:13:45,675 - tweettoot - INFO - relay() => Tweeting 1257952938535858176 to https://mamot.fr
2020-05-10 21:13:45,684 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): mamot.fr
2020-05-10 21:13:46,121 - tweettoot - INFO - toot_the_tweet() => OK. Tooted 1257952938535858176 to https://mamot.fr.
2020-05-10 21:13:46,123 - tweettoot - INFO - relay() => Tweeting 1253782338850508800 to https://mamot.fr
2020-05-10 21:13:46,126 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): mamot.fr
2020-05-10 21:13:46,493 - tweettoot - INFO - toot_the_tweet() => OK. Tooted 1253782338850508800 to https://mamot.fr.
2020-05-10 21:13:46,495 - tweettoot - INFO - relay() => Tweeting 1126934452247121920 to https://mamot.fr
2020-05-10 21:13:46,499 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): mamot.fr
2020-05-10 21:13:47,133 - tweettoot - INFO - toot_the_tweet() => OK. Tooted 1126934452247121920 to https://mamot.fr.
2020-05-10 21:13:47,135 - tweettoot - INFO - relay() => Tweeting 1258775389670965250 to https://mamot.fr
2020-05-10 21:13:47,138 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): mamot.fr
2020-05-10 21:13:47,542 - tweettoot - INFO - toot_the_tweet() => OK. Tooted 1258775389670965250 to https://mamot.fr.
2020-05-10 21:13:47,546 - tweettoot - INFO - relay() => Tweeting 1257935164287713280 to https://mamot.fr
2020-05-10 21:13:47,554 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): mamot.fr
2020-05-10 21:13:48,311 - tweettoot - INFO - toot_the_tweet() => OK. Tooted 1257935164287713280 to https://mamot.fr.
2020-05-10 21:13:48,313 - tweettoot - INFO - relay() => Tweeting 1257919177152696322 to https://mamot.fr
2020-05-10 21:13:48,316 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): mamot.fr
2020-05-10 21:13:49,230 - tweettoot - INFO - toot_the_tweet() => OK. Tooted 1257919177152696322 to https://mamot.fr.
2020-05-10 21:13:49,233 - tweettoot - INFO - relay() => Tweeting 1254007506420092928 to https://mamot.fr
2020-05-10 21:13:49,242 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): mamot.fr
2020-05-10 21:13:49,967 - tweettoot - INFO - toot_the_tweet() => OK. Tooted 1254007506420092928 to https://mamot.fr.
2020-05-10 21:13:49,968 - tweettoot - INFO - relay() => Tweeting 1258718545967489024 to https://mamot.fr
2020-05-10 21:13:49,972 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): mamot.fr
2020-05-10 21:13:50,630 - tweettoot - INFO - toot_the_tweet() => OK. Tooted 1258718545967489024 to https://mamot.fr.
2020-05-10 21:13:50,633 - tweettoot - INFO - relay() => Tweeting 1257745636209963009 to https://mamot.fr
2020-05-10 21:13:50,641 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): mamot.fr
2020-05-10 21:13:51,155 - tweettoot - INFO - toot_the_tweet() => OK. Tooted 1257745636209963009 to https://mamot.fr.
2020-05-10 21:13:51,157 - tweettoot - INFO - relay() => Tweeting 1258655449634803714 to https://mamot.fr
2020-05-10 21:13:51,161 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): mamot.fr
2020-05-10 21:13:51,420 - tweettoot - INFO - toot_the_tweet() => OK. Tooted 1258655449634803714 to https://mamot.fr.
2020-05-10 21:13:51,422 - tweettoot - INFO - relay() => Tweeting 1257708139501236225 to https://mamot.fr
2020-05-10 21:13:51,425 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): mamot.fr
2020-05-10 21:13:52,057 - tweettoot - INFO - toot_the_tweet() => OK. Tooted 1257708139501236225 to https://mamot.fr.
2020-05-10 21:13:52,058 - tweettoot - INFO - relay() => Tweeting 1258323821544771584 to https://mamot.fr
2020-05-10 21:13:52,061 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): mamot.fr
2020-05-10 21:13:52,623 - tweettoot - INFO - toot_the_tweet() => OK. Tooted 1258323821544771584 to https://mamot.fr.
2020-05-10 21:13:52,626 - tweettoot - INFO - relay() => Tweeting 1254050394856136706 to https://mamot.fr
2020-05-10 21:13:52,634 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): mamot.fr
2020-05-10 21:13:53,849 - tweettoot - INFO - toot_the_tweet() => OK. Tooted 1254050394856136706 to https://mamot.fr.
2020-05-10 21:13:53,853 - tweettoot - INFO - relay() => Tweeting 1255202710703558656 to https://mamot.fr
2020-05-10 21:13:53,861 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): mamot.fr
2020-05-10 21:13:56,293 - tweettoot - INFO - toot_the_tweet() => OK. Tooted 1255202710703558656 to https://mamot.fr.
2020-05-10 21:13:56,297 - tweettoot - INFO - relay() => Tweeting 1258103936663400449 to https://mamot.fr
2020-05-10 21:13:56,305 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): mamot.fr
2020-05-10 21:13:56,863 - tweettoot - INFO - toot_the_tweet() => OK. Tooted 1258103936663400449 to https://mamot.fr.
2020-05-10 21:13:56,865 - tweettoot - INFO - relay() => Tweeting 1255123341477851136 to https://mamot.fr
2020-05-10 21:13:56,868 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): mamot.fr
2020-05-10 21:13:57,295 - tweettoot - INFO - toot_the_tweet() => OK. Tooted 1255123341477851136 to https://mamot.fr.
2020-05-10 21:13:57,297 - tweettoot - INFO - relay() => Tweeting 1255466641640562688 to https://mamot.fr
2020-05-10 21:13:57,300 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): mamot.fr
2020-05-10 21:13:57,749 - tweettoot - INFO - toot_the_tweet() => OK. Tooted 1255466641640562688 to https://mamot.fr.

Also, for readability purposes in the config.json file. Maybe we could strip the strings of their empty spaces ' ' when reading them ? It would allow users to add spaces after commas (for readability) and the code to still correctly interpret the string, your opinion ?

ayush-sharma commented 4 years ago

I ran the same on my end with the date-time printed. This is what I got:

2020-05-12 19:41:16,473 - tweettoot - INFO - relay() => Init relay from https://twitter.com/EuroSciPy to https://botsin.space. State file /tmp/tt_b67df4aa5c823c5c3d3c22aa28e4e1c73a86dbe5
2020-05-12 19:41:18,061 - tweettoot - INFO - get_tweets() => Fetched 20 tweets for https://twitter.com/EuroSciPy.
2020-05-12 19:41:18,111 - tweettoot - INFO - relay() => Tweeting 1253737600466276352 to https://botsin.space
2020-05-12 19:41:18,111 - tweettoot - INFO - relay() =>2020-04-24 22:58:31
2020-05-12 19:41:18,111 - tweettoot - INFO - relay() => Tweeting 1251268988912443395 to https://botsin.space
2020-05-12 19:41:18,111 - tweettoot - INFO - relay() =>2020-04-18 03:29:09
2020-05-12 19:41:18,111 - tweettoot - INFO - relay() => Tweeting 1240399282995421190 to https://botsin.space
2020-05-12 19:41:18,111 - tweettoot - INFO - relay() =>2020-03-19 03:36:49
2020-05-12 19:41:18,111 - tweettoot - INFO - relay() => Tweeting 1235987701297487873 to https://botsin.space
2020-05-12 19:41:18,112 - tweettoot - INFO - relay() =>2020-03-06 23:26:46
2020-05-12 19:41:18,112 - tweettoot - INFO - relay() => Tweeting 1235868034062880768 to https://botsin.space
2020-05-12 19:41:18,112 - tweettoot - INFO - relay() =>2020-03-06 15:31:15
2020-05-12 19:41:18,112 - tweettoot - INFO - relay() => Tweeting 1235112746988875777 to https://botsin.space
2020-05-12 19:41:18,112 - tweettoot - INFO - relay() =>2020-03-04 13:30:00
2020-05-12 19:41:18,112 - tweettoot - INFO - relay() => Tweeting 1234538966906527752 to https://botsin.space
2020-05-12 19:41:18,112 - tweettoot - INFO - relay() =>2020-03-02 23:30:00
2020-05-12 19:41:18,112 - tweettoot - INFO - relay() => Tweeting 1234428825464909825 to https://botsin.space
2020-05-12 19:41:18,112 - tweettoot - INFO - relay() =>2020-03-02 16:12:21
2020-05-12 19:41:18,112 - tweettoot - INFO - relay() => Tweeting 1231569185458790400 to https://botsin.space
2020-05-12 19:41:18,112 - tweettoot - INFO - relay() =>2020-02-23 18:49:09
2020-05-12 19:41:18,112 - tweettoot - INFO - relay() => Tweeting 1230798932449644544 to https://botsin.space
2020-05-12 19:41:18,112 - tweettoot - INFO - relay() =>2020-02-21 15:48:27
2020-05-12 19:41:18,112 - tweettoot - INFO - relay() => Tweeting 1230060371114954752 to https://botsin.space
2020-05-12 19:41:18,112 - tweettoot - INFO - relay() =>2020-02-19 14:53:40
2020-05-12 19:41:18,112 - tweettoot - INFO - relay() => Tweeting 1222215009771642886 to https://botsin.space
2020-05-12 19:41:18,112 - tweettoot - INFO - relay() =>2020-01-28 23:19:00
2020-05-12 19:41:18,112 - tweettoot - INFO - relay() => Tweeting 1207642487860453376 to https://botsin.space
2020-05-12 19:41:18,112 - tweettoot - INFO - relay() =>2019-12-19 18:13:00
2020-05-12 19:41:18,112 - tweettoot - INFO - relay() => Tweeting 1207642280535973888 to https://botsin.space
2020-05-12 19:41:18,112 - tweettoot - INFO - relay() =>2019-12-19 18:12:11
2020-05-12 19:41:18,112 - tweettoot - INFO - relay() => Tweeting 1201822155803115521 to https://botsin.space
2020-05-12 19:41:18,113 - tweettoot - INFO - relay() =>2019-12-03 16:45:05
2020-05-12 19:41:18,113 - tweettoot - INFO - relay() => Tweeting 1201506161335439360 to https://botsin.space
2020-05-12 19:41:18,113 - tweettoot - INFO - relay() =>2019-12-02 19:49:26
2020-05-12 19:41:18,113 - tweettoot - INFO - relay() => Tweeting 1199781485097734144 to https://botsin.space
2020-05-12 19:41:18,113 - tweettoot - INFO - relay() =>2019-11-28 01:36:11
2020-05-12 19:41:18,113 - tweettoot - INFO - relay() => Tweeting 1199413419931291648 to https://botsin.space
2020-05-12 19:41:18,113 - tweettoot - INFO - relay() =>2019-11-27 01:13:37
2020-05-12 19:41:18,113 - tweettoot - INFO - relay() => Tweeting 1199405251280936960 to https://botsin.space
2020-05-12 19:41:18,113 - tweettoot - INFO - relay() =>2019-11-27 00:41:10
2020-05-12 19:41:18,113 - tweettoot - INFO - relay() => Tweeting 1182331731644432388 to https://botsin.space
2020-05-12 19:41:18,113 - tweettoot - INFO - relay() =>2019-10-10 21:57:06

The dates seem to be in the right order. I'll try again with your repo and run this.

ayush-sharma commented 4 years ago

Also, I saw that you accidentally committed the Mastodon token in your config.json. Done that myself a few times :) Recommend you rotate credentials immediately, and add the config.json to your .gitignore like I've done in my code.

Didou09 commented 4 years ago

You're right, token rotation done, thanks !

ayush-sharma commented 4 years ago

Hey @Didou09,

Are you still facing the tweet ordering problem?