python-jenkins-developers team mailing list archive
-
python-jenkins-developers team
-
Mailing list archive
-
Message #00689
[Bug 2018576] [NEW] get_build_artifact() tries to parse results as JSON, rendering non-Json artifacts impossible to download
Public bug reported:
Trying to download (potentially binary) artifacts via
```
jenkins_client.get_build_artifact("some_job", 42, "some-file.zip")
```
Results in errors like
```
DEBUG 2023-05-05 09:40:44 urllib3.connectionpool: https://base.url.com:443 "GET /job/some_job/42/artifact/some-file.zip HTTP/1.1" 200 17376
DEBUG 2023-05-05 09:40:44 charset_normalizer: Encoding detection: ascii is most likely the one.
Traceback (most recent call last):
File "../site-packages/jenkins/__init__.py", line 731, in get_build_artifact
return json.loads(response)
^^^^^^^^^^^^^^^^^^^^
File "../json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "../json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "../json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
```
This seems to happen because `jenkins/__init__.py` implements `get_build_artifact()` expecting JSON result:
```
response = self.jenkins_open(requests.Request(
'GET', self._build_url(BUILD_ARTIFACT, locals())))
if response:
return json.loads(response)
else:
raise JenkinsException('job[%s] number[%s] does not exist' % (name, number))
```
** Affects: python-jenkins
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Python
Jenkins Developers, which is subscribed to Python Jenkins.
https://bugs.launchpad.net/bugs/2018576
Title:
get_build_artifact() tries to parse results as JSON, rendering non-
Json artifacts impossible to download
Status in Python Jenkins:
New
Bug description:
Trying to download (potentially binary) artifacts via
```
jenkins_client.get_build_artifact("some_job", 42, "some-file.zip")
```
Results in errors like
```
DEBUG 2023-05-05 09:40:44 urllib3.connectionpool: https://base.url.com:443 "GET /job/some_job/42/artifact/some-file.zip HTTP/1.1" 200 17376
DEBUG 2023-05-05 09:40:44 charset_normalizer: Encoding detection: ascii is most likely the one.
Traceback (most recent call last):
File "../site-packages/jenkins/__init__.py", line 731, in get_build_artifact
return json.loads(response)
^^^^^^^^^^^^^^^^^^^^
File "../json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "../json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "../json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
```
This seems to happen because `jenkins/__init__.py` implements `get_build_artifact()` expecting JSON result:
```
response = self.jenkins_open(requests.Request(
'GET', self._build_url(BUILD_ARTIFACT, locals())))
if response:
return json.loads(response)
else:
raise JenkinsException('job[%s] number[%s] does not exist' % (name, number))
```
To manage notifications about this bug go to:
https://bugs.launchpad.net/python-jenkins/+bug/2018576/+subscriptions