Univention Bugzilla – Bug 45456
[RESTful Import API] client library and import UI do not handle HTTP 404
Last modified: 2023-06-12 15:39:39 CEST
When the ucs-school-umc-import UMC UI is installed and opened, and the API cannot be reached (in my case it was simply not installed), this happens: ------------------------------------- Execution of command 'schoolimport/jobs/query' has failed: Traceback (most recent call last): File "/usr/lib/pymodules/python2.7/univention/management/console/protocol/modserver.py", line 178, in _recv self.handle(msg) File "/usr/lib/pymodules/python2.7/univention/management/console/protocol/modserver.py", line 287, in handle self.__handler.init() File "/usr/lib/pymodules/python2.7/univention/management/console/modules/schoolimport/__init__.py", line 66, in init self.client = Client(self.username, self.password, log_level=Client.LOG_RESPONSE) File "/usr/lib/pymodules/python2.7/ucsschool/http_api/client.py", line 316, in __init__ setattr(self, cls_name, kls(self)) File "/usr/lib/pymodules/python2.7/ucsschool/http_api/client.py", line 399, in __init__ self.resource_url = self.client.resource_urls[self.resource_name] File "/usr/lib/pymodules/python2.7/ucsschool/http_api/client.py", line 326, in resource_urls self._resource_urls = self.call_api('get', '.') File "/usr/lib/pymodules/python2.7/ucsschool/http_api/client.py", line 390, in call_api raise exc(msg, status_code=response.status_code) ObjectNotFound: Received status_code=404 with reason='Not Found' for requests.get(**files=None, url=u'https://m150.uni.dtr/api/v1/', auth=('Administrator', u'**********'), headers={u'Accept': u'application/json'}, params=None, data=None). ------------------------------------- Modify the Python client and the UMC module to handle 404.
commit 41adaef0935bdbbc16b4bf785afe50f46904a64d Author: Florian Best <best@univention.de> Date: Wed Oct 11 12:53:34 2017 +0200 Bug #45023: handle HTTP 404 error if the API server is not installed *** This bug has been marked as a duplicate of bug 45023 ***