HTTP GET Example "timeout" with bigger payloads

I noticed something strange with the http get example (at least in my setup).

I am using the http get example from here. I edited the code to make authentication work (see example in Docs).

When I sent the GET request for a small payload such as {"this is": "json"} it works fine every run. If I request a bigger payload, it will often/always print

INFO: Sending a GET request.
DEBUG: Response: ['\r\nOK\r\n']
DEBUG: Processed: ['OK']
DEBUG: Response: ['\r\nOK\r\n']
DEBUG: Processed: ['OK']
INFO: {'response': ['OK'], 'status': 0}
DEBUG: Processed: ['+QHTTPGET: 0,201,454', 'CONNECT', '{"PicoSleepMin":15,"LongSleepLoop":1,"Datetime":"DJwiofgwqodfouvwbrguj23456743245nuztbewfbaeioufbeufgibfuiebfiewbgiwb","Key":"DJwiofgwqodfouvwbrguj23456743245nuztbewfbaeioufbeufgibfuiebfiewbgiwb","LONGSTRING":"DJwiofgwqodfouvwbrguj23456743245nuztbewfbae']
INFO: {'response': 'timeout', 'status': 2}

The request however is properly received and returned with status code 201/200

Here’s my code:

import time
from pico_lte.utils.status import Status
from pico_lte.core import PicoLTE
from pico_lte.common import debug

picoLTE = PicoLTE()

picoLTE.network.register_network()
picoLTE.http.set_context_id()
picoLTE.network.get_pdp_ready()
picoLTE.http.set_server_url()
picoLTE.http.set_auth()
debug.set_level(0)
debug.info("Sending a GET request.")

result = picoLTE.http.get()
debug.info(result)

# Read the response after 5 seconds (or 20) does not help...
time.sleep(5)
result = picoLTE.http.read_response()
debug.info(result)
if result["status"] == Status.SUCCESS:
    debug.info("Get request succeeded.")

Payload (GET Result)

{
    "PicoSleepMin": 15,
    "LongSleepLoop": 1,
    "Datetime": "DJwiofgwqodfouvwbrguj23456743245nuztbewfbaeioufbeufgibfuiebfiewbgiwb",
    "Key": "DJwiofgwqodfouvwbrguj23456743245nuztbewfbaeioufbeufgibfuiebfiewbgiwb",
    "LONGSTRING": "DJwiofgwqodfouvwbrguj23456743245nuztbewfbaeioufbeufgibfuiebfiewbgiwb",
    "https": {
        "username": "DJwiofgwqodfouvwbrguj23456743245nuztbewfbaeioufbeufgibfuiebfiewbgiwb",
        "password": "DJwiofgwqodfouvwbrguj23456743245nuztbewfbaeioufbeufgibfuiebfiewbgiwb"
    }
}

I checked the documentation and set timeout or input_timeout to higher values without success. E.g.

picoLTE.http.read_response(timeout=20)

Hi,

Thank you for bringing this to our attention. We’re on it and will get back to you with a solution as soon as possible.

Did you find a solution? I digged a little bit and it seems, that whatever I set the timeout, it never receives the full payload from the GET request.

I noticed the same behaviour with POST payloads. Sending something like this, results in a timeout (but is properly received!)

payload = {
        "variable_name": value,
        "variable_name": value,
        "variable_name": value,
        "variable_name": value,
        "variable_name": value,
        "variable_name": value,
        "variable_name": value,
        "variable_name": value,
        "variable_name": array_value # 3 elements
}
# return value on Pico
DEBUG: {'response': 'timeout', 'status': 2}

Thank you for your patience. Our team is actively working on the issue and we’ll update you as soon as we have a solution in place.

Any update on this? I was going to switch to MQTT but since it might suffer of the same (timeout?) issue, I did not test it, yet.

It’s frustrating, the 60$ device is not suitable to my use case at the moment :-/

We apologise for the delay.

This error occurred due to the Pico’s UART RX buffer size being full. Therefore, we increased the buffer limit. You can solve this issue by using the dev branch. We would appreciate it if you share the outputs.

For some reason I missed the notification for your reply since my late answer.
I updated to dev branch and it’s working flawless now! Thank you very much.
Just in time to get it installed (finally) :slight_smile:

1 Like