TypeError exception thrown from CustomCloud.sendMessage

When I retrieve a small web page using CustomCloud, an exception is thrown from the read_socket method of the Modem class. The read socket data command (+USORD) apparently fails because the number of bytes requested exceeds the maximum allowed (512 in HEX mode).

Am I missing something?

Modem: Nova-R410
Python SDK Version: 0.9.0
SARA-R410 Firmware Version: L0.

Here’s the code:

from Hologram.CustomCloud import CustomCloud
import logging

logger = logging.getLogger()

handler = logging.StreamHandler()

o = CustomCloud(None, network=‘cellular’, send_host=‘www.example.com’, send_port=80)

message = ‘GET / HTTP/1.1\r\n’
‘Host: www.example.com\r\n\r\n’

response = o.sendMessage(bytes(message, encoding=‘utf-8’))

And the stack trace:

Traceback (most recent call last):
File “demo.py”, line 20, in
response = o.sendMessage(bytes(message, encoding=‘utf-8’))
File “/usr/local/lib/python3.7/dist-packages/Hologram/CustomCloud.py”, line 78, in sendMessage
resultbuf = self.network.send_message(message)
File “/usr/local/lib/python3.7/dist-packages/Hologram/Network/Cellular.py”, line 127, in send_message
return self.modem.send_message(data)
File “/usr/local/lib/python3.7/dist-packages/Hologram/Network/Modem/Modem.py”, line 256, in send_message
return self.read_socket()
File “/usr/local/lib/python3.7/dist-packages/Hologram/Network/Modem/Modem.py”, line 325, in read_socket
bytedata = binascii.unhexlify(resp)
TypeError: argument should be bytes, buffer or ASCII string, not ‘NoneType’

Ah I thought this was for sending. I can open a task for this on the github. Though if you are retrieving websites the modem based socket method probably isn’t as safe as just standing up a PPP connection and grabbing the site that way.

OK. Thanks for the reply and recommendation.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.