Skip to content

callAPI() throws TypeError exception if API returns 503  #7

@dazzag24

Description

@dazzag24

I slightly modified the code in callAPI() from this:

elif response.status_code != 200:
raise HODException(response,response.status_code)

to this:

elif response.status_code != 200:
print "HOD Returned:"
print response.status_code
raise HODException(response,response.status_code)

to find out what error code was being returned.

HOD Returned:
503
Traceback (most recent call last):

File "/home/darreng/.local/lib/python2.7/site-packages/havenondemand/hodindex.py", line 174, in commit
r=self.client.post("addtotextindex",data=data,files={'fake':''},async=async)
File "/home/darreng/.local/lib/python2.7/site-packages/havenondemand/hodindex.py", line 92, in post
return self.callAPI(url,data,files,async)
File "/home/darreng/.local/lib/python2.7/site-packages/havenondemand/hodindex.py", line 110, in callAPI
raise HODException(response,response.status_code)
File "/home/darreng/.local/lib/python2.7/site-packages/havenondemand/hodindex.py", line 20, in init
Exception.init(self, "Response code {} - Error {} - {} ]n Details: {} ".format(code,rjson["error"],rjson["reason"],rjson))
TypeError: 'Response' object has no attribute 'getitem'

I think the Exception handler itself has an issue that causes the resulting:

TypeError: 'Response' object has no attribute 'getitem'

exception.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions