X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osmclient%2Fsol005%2Fhttp.py;h=d76e41e4f5a5e3f30fc781383f2289a7120026f2;hb=9e7817e31ea1f913c9f673fd51f58da71de9c03c;hp=c89e91b979318bdca0824b9110be922138e8d23a;hpb=3fbf81c9deb88d05b23fb3631fb53bc09752e32d;p=osm%2Fosmclient.git diff --git a/osmclient/sol005/http.py b/osmclient/sol005/http.py index c89e91b..d76e41e 100644 --- a/osmclient/sol005/http.py +++ b/osmclient/sol005/http.py @@ -50,13 +50,9 @@ class Http(http.Http): curl_cmd.close() # TODO 202 accepted should be returned somehow if data.getvalue(): - return json.loads(data.getvalue().decode()) - elif http_code == 404: - return "NOT FOUND" - elif http_code >= 300: - return "Failed" + return http_code, json.loads(data.getvalue().decode()) else: - return + return http_code, None def send_cmd(self, endpoint='', postfields_dict=None, formfile=None, filename=None, @@ -124,6 +120,9 @@ class Http(http.Http): curl_cmd.setopt(pycurl.HTTPGET, 1) curl_cmd.setopt(pycurl.WRITEFUNCTION, data.write) curl_cmd.perform() + http_code = curl_cmd.getinfo(pycurl.HTTP_CODE) curl_cmd.close() - return data.getvalue() + if data.getvalue(): + return http_code, data.getvalue() + return http_code, None