Compare commits

...

2 Commits

Author SHA1 Message Date
Gitea 0bf1d379e8 Improve errorhandling 2023-04-12 18:26:18 +02:00
Gitea 7ba769b78a Add .gitignore 2023-04-12 18:23:38 +02:00
2 changed files with 13 additions and 4 deletions

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
log
data
__pycache__
nohup.out
settings.py

12
main.py
View File

@ -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'