generated from Hazel/python-project
implemented silent connection which should not throw any errors
This commit is contained in:
parent
593c975418
commit
ae997fd0bf
@ -1,7 +1,7 @@
|
|||||||
import argparse
|
import argparse
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from .connections import Connection
|
from .connections import Connection, SilentConnection
|
||||||
from . import cache
|
from . import cache
|
||||||
|
|
||||||
|
|
||||||
|
@ -151,3 +151,11 @@ class Connection:
|
|||||||
json=json,
|
json=json,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
||||||
|
class SilentConnection(Connection):
|
||||||
|
def send_request(self, request: requests.Request, attempt: int = 0) -> Optional[requests.Response]:
|
||||||
|
try:
|
||||||
|
return super().send_request(request, attempt)
|
||||||
|
except requests.HTTPError as e:
|
||||||
|
log.warning(str(e))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user