micropython / micropython/micropython-lib

OSError 16 when executing urequests.post()

Open
#429 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2.9k
Forks
1.1k
Avg merge
7d 6h
Merged PRs (30d)
3

Description

I'm trying to send data to a spreadsheet hosted on Google using the post function on urequests.py

my code:

request_data = ujson.dumps({
    "parameter": {
        "Beer": "Test",
        "Temp": 65,
        "SG":1.050,
        "Color":"ORANGE",
        "Comment":"user@gmail.com, TiltESP32",
        "Timepoint":43486.6
    }
})

print("url: {} - data: {}".format(device['cloud_url'], request_data))
response = urequests.post(device['cloud_url'], headers = {'content-type': 'application/json'}, data = request_data)

result:

url: https://script.google.com/macros/s/AKfycbwNXh6rEWoULd0vxWxDylG_PJwQwe0dn5hdtSkuC4k3D9AXBSA/exec - data: {"parameter": {"Comment": "user@gmail.com, TiltESP32", "Beer": "Test", "Temp": 65, "SG": 1.05, "Color": "ORANGE", "Timepoint": 43486.6}}
Traceback (most recent call last):
  File "main.py", line 108, in bt_irq
  File "main.py", line 46, in handle_ibeacon
  File "main.py", line 100, in log_data
  File "urequests.py", line 120, in post
  File "urequests.py", line 62, in request
OSError: 16

Here is the line where the error is hapening: https://github.com/micropython/micropython-lib/blob/2e91b924135deee7e287fb20bdd6b158a2914b66/python-ecosys/urequests/urequests.py#L62

I'm using a standard ESP-WROOM-32 board with the imagem file https://micropython.org/resources/firmware/esp32-20210610-unstable-v1.15-202-g71e3538a3.bin

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at urequests.py line 62 and reproduce the JSON POST on the ESP32 firmware version reported in the issue. Determine what causes OSError 16 in this request path and verify that the resulting behavior is documented or corrected for the reported urequests.post() case.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.