catch errors when sending messages
This commit is contained in:
parent
310f1aee17
commit
057f737cf8
|
@ -14,7 +14,8 @@
|
||||||
],
|
],
|
||||||
"ignore_files": [
|
"ignore_files": [
|
||||||
"reload.py",
|
"reload.py",
|
||||||
"test.py"
|
"test.py",
|
||||||
|
"manage.py"
|
||||||
],
|
],
|
||||||
"log_level": "INFO"
|
"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-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-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-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-sql&subdirectory=sql
|
||||||
-e git+https://git.barkshark.xyz/izaliamae/izzylib.git@rework#egg=izzylib-templates&subdirectory=template
|
-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 functools import wraps
|
||||||
from izzylib import LruCache, logging
|
from izzylib import LruCache, logging
|
||||||
from izzylib.http_urllib_client import HttpUrllibClient
|
from izzylib.http_urllib_client import HttpUrllibClient
|
||||||
|
from izzylib.http_urllib_client.error import MaxRetryError
|
||||||
|
|
||||||
from . import __version__
|
from . import __version__
|
||||||
from .config import config
|
from .config import config
|
||||||
|
@ -90,20 +91,28 @@ def get_inbox(actor):
|
||||||
|
|
||||||
def push_message(inbox, message):
|
def push_message(inbox, message):
|
||||||
with db.session as s:
|
with db.session as s:
|
||||||
response = client.request(
|
try:
|
||||||
inbox,
|
response = client.request(
|
||||||
body = message.to_json(),
|
inbox,
|
||||||
method = 'post',
|
body = message.to_json(),
|
||||||
privkey = s.get.config('privkey'),
|
method = 'post',
|
||||||
keyid = f'https://{config.host}/actor#main-key'
|
privkey = s.get.config('privkey'),
|
||||||
)
|
keyid = f'https://{config.host}/actor#main-key'
|
||||||
|
)
|
||||||
|
|
||||||
if response.status not in [200, 202]:
|
if response.status not in [200, 202]:
|
||||||
try:
|
try:
|
||||||
body = response.dict
|
body = response.dict
|
||||||
except:
|
except:
|
||||||
body = response.text
|
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):
|
def cmd_accept(self, url):
|
||||||
cmd_request('accept', url)
|
return self.cmd_request('accept', url)
|
||||||
|
|
||||||
|
|
||||||
def cmd_reject(self, url):
|
def cmd_reject(self, url):
|
||||||
cmd_request('reject', url)
|
return self.cmd_request('reject', url)
|
||||||
|
|
||||||
|
|
||||||
def cmd_list(self):
|
def cmd_list(self):
|
||||||
|
|
Loading…
Reference in a new issue