mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-01 08:53:37 +00:00
Merge pull request #185 from JackDandy/feature/AddRequestResponseExceptionCatcher
Add catch exceptions when unable to cache a requests response.
This commit is contained in:
commit
3704e9a295
3 changed files with 10 additions and 4 deletions
|
@ -51,6 +51,7 @@
|
|||
* Fix SSL authentication on Synology stations
|
||||
* Change IPT urls to reduce 301 redirection
|
||||
* Add detection of file-system having no support for link creation (e.g. Unraid shares)
|
||||
* Add catch exceptions when unable to cache a requests response
|
||||
|
||||
[develop changelog]
|
||||
* Change uT params from unicode to str.format as magnet URLs worked but sending files in POST bodies failed
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
from requests.adapters import HTTPAdapter
|
||||
from lib.requests.adapters import HTTPAdapter
|
||||
|
||||
from .controller import CacheController
|
||||
from .cache import DictCache
|
||||
|
||||
|
||||
class CacheControlAdapter(HTTPAdapter):
|
||||
invalidating_methods = set(['PUT', 'DELETE'])
|
||||
|
||||
|
@ -58,7 +59,11 @@ class CacheControlAdapter(HTTPAdapter):
|
|||
response = cached_response
|
||||
else:
|
||||
# try to cache the response
|
||||
try:
|
||||
self.controller.cache_response(request, response)
|
||||
except Exception as e:
|
||||
# Failed to cache the results
|
||||
pass
|
||||
|
||||
resp = super(CacheControlAdapter, self).build_response(
|
||||
request, response
|
||||
|
|
|
@ -6,7 +6,7 @@ import calendar
|
|||
import time
|
||||
import datetime
|
||||
|
||||
from requests.structures import CaseInsensitiveDict
|
||||
from lib.requests.structures import CaseInsensitiveDict
|
||||
|
||||
from .cache import DictCache
|
||||
from .compat import parsedate_tz
|
||||
|
@ -21,7 +21,7 @@ def parse_uri(uri):
|
|||
(scheme, authority, path, query, fragment) = parse_uri(uri)
|
||||
"""
|
||||
groups = URI.match(uri).groups()
|
||||
return (groups[1], groups[3], groups[4], groups[6], groups[8])
|
||||
return groups[1], groups[3], groups[4], groups[6], groups[8]
|
||||
|
||||
|
||||
class CacheController(object):
|
||||
|
|
Loading…
Reference in a new issue