catch errors when sending messages
This commit is contained in:
parent
310f1aee17
commit
057f737cf8
|
@ -14,7 +14,8 @@
|
|||
],
|
||||
"ignore_files": [
|
||||
"reload.py",
|
||||
"test.py"
|
||||
"test.py",
|
||||
"manage.py"
|
||||
],
|
||||
"log_level": "INFO"
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
-e git+https://git.barkshark.xyz/izaliamae/izzylib.git@rework#egg=izzylib-base&subdirectory=base
|
||||
-e git+https://git.barkshark.xyz/izaliamae/izzylib.git@rework#egg=izzylib-password-hasher&subdirectory=hasher
|
||||
-e git+https://git.barkshark.xyz/izaliamae/izzylib.git@rework#egg=izzylib-http-erver&subdirectory=http_server
|
||||
-e git+https://git.barkshark.xyz/izaliamae/izzylib.git@rework#egg=izzylib-http-server&subdirectory=http_server
|
||||
-e git+https://git.barkshark.xyz/izaliamae/izzylib.git@rework#egg=izzylib-http-urllib-client&subdirectory=http_urllib_client
|
||||
-e git+https://git.barkshark.xyz/izaliamae/izzylib.git@rework#egg=izzylib-sql&subdirectory=sql
|
||||
-e git+https://git.barkshark.xyz/izaliamae/izzylib.git@rework#egg=izzylib-templates&subdirectory=template
|
||||
|
|
|
@ -3,6 +3,7 @@ import json
|
|||
from functools import wraps
|
||||
from izzylib import LruCache, logging
|
||||
from izzylib.http_urllib_client import HttpUrllibClient
|
||||
from izzylib.http_urllib_client.error import MaxRetryError
|
||||
|
||||
from . import __version__
|
||||
from .config import config
|
||||
|
@ -90,20 +91,28 @@ def get_inbox(actor):
|
|||
|
||||
def push_message(inbox, message):
|
||||
with db.session as s:
|
||||
response = client.request(
|
||||
inbox,
|
||||
body = message.to_json(),
|
||||
method = 'post',
|
||||
privkey = s.get.config('privkey'),
|
||||
keyid = f'https://{config.host}/actor#main-key'
|
||||
)
|
||||
try:
|
||||
response = client.request(
|
||||
inbox,
|
||||
body = message.to_json(),
|
||||
method = 'post',
|
||||
privkey = s.get.config('privkey'),
|
||||
keyid = f'https://{config.host}/actor#main-key'
|
||||
)
|
||||
|
||||
if response.status not in [200, 202]:
|
||||
try:
|
||||
body = response.dict
|
||||
except:
|
||||
body = response.text
|
||||
if response.status not in [200, 202]:
|
||||
try:
|
||||
body = response.dict
|
||||
except:
|
||||
body = response.text
|
||||
|
||||
logging.debug(f'Error from {inbox}: {body}')
|
||||
logging.debug(f'Error from {inbox}: {body}')
|
||||
|
||||
return response
|
||||
return response
|
||||
|
||||
## this exception catching will be used later
|
||||
except Exception as s:
|
||||
pass
|
||||
|
||||
except MaxRetryError:
|
||||
pass
|
||||
|
|
|
@ -161,11 +161,11 @@ python3 -m uncia.manage convert [pleroma or uncia]:
|
|||
|
||||
|
||||
def cmd_accept(self, url):
|
||||
cmd_request('accept', url)
|
||||
return self.cmd_request('accept', url)
|
||||
|
||||
|
||||
def cmd_reject(self, url):
|
||||
cmd_request('reject', url)
|
||||
return self.cmd_request('reject', url)
|
||||
|
||||
|
||||
def cmd_list(self):
|
||||
|
|
Loading…
Reference in a new issue