Hi!
Currently, update_config() converts the config to str type without encoding format.
So it does not support unicode characters. For example:
>>> jk.get_job('job1').update_config('中文')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Leo\AppData\Local\Programs\Python\Python39\lib\site-packages\jenkinsapi\job.py", line 640, in update_config
response = self.jenkins.requester.post_url(url, params={}, data=config)
...
File "C:\Users\Leo\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 164, in _encode
raise UnicodeEncodeError(
UnicodeEncodeError: 'latin-1' codec can't encode characters in position 0-1: Body ('中文') is not valid Latin-1. Use body.encode('utf-8') if you want to send it encoded in UTF-8.
So I submitted this PR to encode the config in utf-8 by default.
Looking forward to your review.
Hi! Currently,
update_config()
converts theconfig
tostr
type without encoding format. So it does not support unicode characters. For example:So I submitted this PR to encode the config in utf-8 by default. Looking forward to your review.