Improve errorhandling
This commit is contained in:
parent
7ba769b78a
commit
0bf1d379e8
12
main.py
12
main.py
|
@ -57,8 +57,9 @@ def main():
|
|||
pubdate = datetime.now(pubdate.tzinfo) # Fix later pubdate is not defined
|
||||
if pubdate > datetime.now(pubdate.tzinfo) - timedelta(days=5):
|
||||
if not line in send_data:
|
||||
result = api.status_post(
|
||||
(title + "\n\n" + item['link']),
|
||||
try:
|
||||
result = api.status_post(
|
||||
(title + "\n\n Source: " + item['link']),
|
||||
reply_id, #in_reply_to_id
|
||||
None, #media_ids
|
||||
False, #sensitive
|
||||
|
@ -70,8 +71,11 @@ def main():
|
|||
None, #scheduled_at
|
||||
None, #poll
|
||||
None, #quote_id
|
||||
)
|
||||
if result.id:
|
||||
)
|
||||
except Exception as exception:
|
||||
result = False
|
||||
print("err: (" + type(exception).__name__ + ") " + title + item['link'])
|
||||
if result and result.id:
|
||||
if not reply_id:
|
||||
reply_id = result.id
|
||||
visibility = 'unlisted'
|
||||
|
|
Loading…
Reference in New Issue