Bug 1128362
Summary: | copr API error responses should use correct error codes | ||
---|---|---|---|
Product: | [Community] Copr | Reporter: | Jakub Ruzicka <jruzicka> |
Component: | frontend | Assignee: | Jakub Kadlčík <jkadlcik> |
Status: | CLOSED CURRENTRELEASE | QA Contact: | |
Severity: | unspecified | Docs Contact: | |
Priority: | unspecified | ||
Version: | unspecified | CC: | clime, msuchy |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2019-02-19 12:43:54 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Jakub Ruzicka
2014-08-09 14:06:22 UTC
Thanks, I'll have a look at that We apologize, that this took years, but it is finally done. Meanwhile, both APIv1 (aka Legacy API) and APIv2 (aka REST-like API) are deprecated, so this was implemented in new APIv3. See this example code from copr.v3 import Client, CoprRequestException client = Client.create_from_config_file() client.config["login"] = None # So we can't authorize try: url = "http://foo.bar/baz.src.rpm" client.build_proxy.create_from_url("@copr", "foo", url) except CoprRequestException as ex: print(ex.result.__response__.status_code) print(ex.message) 401 Login invalid/expired. Please visit http://localhost:5000/api to get or renew your API token. Please see the Debugging section in the documentation - https://python-copr.readthedocs.io/en/latest/client_v3/error_handling.html#debugging There are also described status codes that you can expect, but it was not released yet - https://pagure.io/copr/copr/pull-request/392#request_diff A package fixing this issue has been deployed to the production instance. Also, the list of status codes is now in the documentation - https://python-copr.readthedocs.io/en/latest/client_v3/error_handling.html#status-codes |