Wait for random interval before tooting
This commit is contained in:
parent
b78b1654e2
commit
d43d2aa3e2
1 changed files with 5 additions and 0 deletions
|
@ -9,11 +9,16 @@ import requests
|
||||||
import re
|
import re
|
||||||
import sqlite3
|
import sqlite3
|
||||||
from datetime import datetime, date, time, timedelta
|
from datetime import datetime, date, time, timedelta
|
||||||
|
import time
|
||||||
|
import random
|
||||||
|
|
||||||
if len(sys.argv) < 4:
|
if len(sys.argv) < 4:
|
||||||
print("Usage: python3 tootbot.py twitter_account mastodon_login mastodon_passwd mastodon_instance")
|
print("Usage: python3 tootbot.py twitter_account mastodon_login mastodon_passwd mastodon_instance")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
sleep_time = random.randomin(0, 5 * 60)
|
||||||
|
time.sleep(sleep_time)
|
||||||
|
|
||||||
# sqlite db to store processed tweets (and corresponding toots ids)
|
# sqlite db to store processed tweets (and corresponding toots ids)
|
||||||
sql = sqlite3.connect('tootbot.db')
|
sql = sqlite3.connect('tootbot.db')
|
||||||
db = sql.cursor()
|
db = sql.cursor()
|
||||||
|
|
Loading…
Reference in a new issue