Ignore HTTP500 in optional notifications

This commit is contained in:
Florian Bach 2021-12-16 14:28:55 +01:00
parent 1fa8e28c53
commit 5451766f0a
2 changed files with 9 additions and 1 deletions

View File

@ -33,6 +33,8 @@
# fix ACSM files from Google Play books (no metadata node), # fix ACSM files from Google Play books (no metadata node),
# allow converting an anonymous auth to an AdobeID auth, # allow converting an anonymous auth to an AdobeID auth,
# update python-cryptography from 3.4.8 to 36.0.1, update python-rsa from 4.7.2 to 4.8. # update python-cryptography from 3.4.8 to 36.0.1, update python-rsa from 4.7.2 to 4.8.
# Currently in development:
# Ignore fatal HTTP errors during optional fulfillment notifications.
PLUGIN_NAME = "DeACSM" PLUGIN_NAME = "DeACSM"
PLUGIN_VERSION_TUPLE = (0, 0, 15) PLUGIN_VERSION_TUPLE = (0, 0, 15)

View File

@ -271,7 +271,13 @@ def sendPOSTHTTPRequest(URL: str, document: bytes, type: str, returnRC = False):
ctx.verify_mode = ssl.CERT_NONE ctx.verify_mode = ssl.CERT_NONE
req = urllib.request.Request(url=URL, headers=headers, data=document) req = urllib.request.Request(url=URL, headers=headers, data=document)
handler = urllib.request.urlopen(req, context=ctx) try:
handler = urllib.request.urlopen(req, context=ctx)
except urllib.error.HTTPError as err:
# This happens with HTTP 500 and related errors.
print("Post request caused HTTPError %d" % (err.code))
return err.code, "Post request caused HTTPException"
ret_code = handler.getcode() ret_code = handler.getcode()
if (ret_code == 204 and returnRC): if (ret_code == 204 and returnRC):