1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-08-06 15:43:39 +02:00

Merge pull request #485 from lethliel/python3_babysitter_module

[python3] babysitter.py msg and body are byte strings
This commit is contained in:
Marco Strigl
2019-04-15 15:04:32 +02:00
committed by GitHub

View File

@@ -16,6 +16,7 @@ from osc import oscerr
from .oscsslexcp import NoSecureSSLError
from osc.util.cpio import CpioError
from osc.util.packagequery import PackageError
from osc.util.helper import decode_it
try:
from M2Crypto.SSL.Checker import SSLVerificationError
@@ -112,11 +113,11 @@ def run(prg, argv=None):
print(body, file=sys.stderr)
if e.code in [400, 403, 404, 500]:
if '<summary>' in body:
msg = body.split('<summary>')[1]
msg = msg.split('</summary>')[0]
msg = msg.replace('&lt;', '<').replace('&gt;' , '>').replace('&amp;', '&')
print(msg, file=sys.stderr)
if b'<summary>' in body:
msg = body.split(b'<summary>')[1]
msg = msg.split(b'</summary>')[0]
msg = msg.replace(b'&lt;', b'<').replace(b'&gt;' , b'>').replace(b'&amp;', b'&')
print(decode_it(msg), file=sys.stderr)
if e.code >= 500 and e.code <= 599:
print('\nRequest: %s' % e.filename)
print('Headers:')