Skip to content

AttributeError: 'HTTPResponse' object has no attribute 'message' with bad API url #1

@Talkless

Description

@Talkless

Hi,

Python 3.4.2 (Debian 8 jessie), intis 0.2 from PyPi.

Looks like urllib exception is not transfered successfully on failure:

Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/intis/client.py", line 40, in http_response
    handle = urllib_request.urlopen('%s%s' % (self.host, url))
  File "/usr/lib/python3.4/urllib/request.py", line 153, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.4/urllib/request.py", line 461, in open
    response = meth(req, response)
  File "/usr/lib/python3.4/urllib/request.py", line 571, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python3.4/urllib/request.py", line 499, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.4/urllib/request.py", line 433, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.4/urllib/request.py", line 579, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "mysmstest.py", line 109, in <module>
    main()
  File "mysmstest.py", line 106, in main
    send_sms_message(args.is_test, args.sender, receivers, message)
  File "mysmstest.py", line 84, in send_sms_message
    response = client.message_send(receivers, sender, message)
  File "/usr/local/lib/python3.4/dist-packages/intis/utils.py", line 25, in wrapper
    content = func(*args, **kwargs)
  File "/usr/local/lib/python3.4/dist-packages/intis/client.py", line 183, in message_send
    'text': text
  File "/usr/local/lib/python3.4/dist-packages/intis/client.py", line 88, in get_result
    params = self.prepare_params(params)
  File "/usr/local/lib/python3.4/dist-packages/intis/client.py", line 74, in prepare_params
    'timestamp': self.timestamp,
  File "/usr/local/lib/python3.4/dist-packages/intis/client.py", line 55, in timestamp
    return self.http_response('timestamp.php')
  File "/usr/local/lib/python3.4/dist-packages/intis/client.py", line 42, in http_response
    raise self.HTTPError(e)
  File "/usr/local/lib/python3.4/dist-packages/intis/exceptions.py", line 71, in __init__
    super(IntisHTTPError, self).__init__(str(self))
  File "/usr/local/lib/python3.4/dist-packages/intis/exceptions.py", line 75, in __str__
    'Intis Http Error %s: %s' % (self.e.code, self.e.message)
  File "/usr/lib/python3.4/tempfile.py", line 533, in __getattr__
    a = getattr(file, name)
AttributeError: 'HTTPResponse' object has no attribute 'message'

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions