Skip to content

Conversation

@relic-se
Copy link
Contributor

@relic-se relic-se commented Dec 9, 2025

Chunked transfers are already supported within adafruit_requests but the content-length check within adafruit_portalbase.network.NetworkBase.wget (see below) prevents them from working because they leave that header omitted. (see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Transfer-Encoding#chunked for reference)

if "content-length" in headers:
content_length = int(headers["content-length"])
else:
raise RuntimeError("Content-Length missing from headers")

This update extends wget to allow chunked transfers.

I've provided a simple demonstration using the Adafruit Fruit Jam to download the source files zipball from a GitHub repository which uses chunked transfer encoding.

# Adafruit CircuitPython 10.0.3 on 2025-10-17; Adafruit Fruit Jam with rp2350b
import adafruit_fruitjam
fj = adafruit_fruitjam.FruitJam()
fj.network.connect()
fj.network.wget("https://api.github.com/repos/adafruit/Adafruit_CircuitPython_PortalBase/zipball/3.4.2", "/test.zip")
Connecting to AP ...
Fetching stream from https://api.github.com/repos/adafruit/Adafruit_CircuitPython_PortalBase/zipball/3.4.2
Reply is OK!
Saving data to  /sd/test.zip
...................Created file of 52446 bytes in 0.7 seconds

I've provided more information in my investigation here: relic-se/Fruit_Jam_Library#12.

This update also includes compatibility fixes for adafruit_display_text version 3.4.0 related to outlined labels. (https://github.com/adafruit/Adafruit_CircuitPython_Display_Text/releases/tag/3.4.0)

from adafruit_bitmap_font import bitmap_font
from adafruit_display_text import wrap_text_to_lines
from adafruit_display_text.bitmap_label import Label
from adafruit_display_text.outlined_label import OutlinedLabel
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should wait a bit on changing this. Some of the device specific libraries that are use PortalBase are for devices with Display Text frozen in.

Unless users of those devices put the latest Display Text library in the root of CIRCUITPY, they won't have access to the newest version.

I think this should only change here after there is a new core release that includes the updated Display Text frozen in

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does unfortunately mean that when this library is in use on devices without frozen Display Text it will be printing that deprecation message.

Maybe we should disable the warning print for now and only turn it back on after that release is out so that updating is possible / easy for all devices.

Copy link
Contributor Author

@relic-se relic-se Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I should be able to catch an ImportError so that it will work in both scenarios. Normally, I wouldn't want to touch this in the PR, but it was throwing an error in addition to the deprecation warning:

ImportError: cannot import name 'OutlinedLabel' from 'adafruit_display_text.outlined_label' (/opt/hostedtoolcache/Python/3.12.12/x64/lib/python3.12/site-packages/adafruit_display_text/outlined_label.py). Did you mean: 'outlined_label'?

Copy link
Contributor Author

@relic-se relic-se Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know if the most recent commit, cdbce86, works for you.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Portal_Base is also a frozen library. Maybe some code that checks if the Bitmap Label has outline_color or outline_size properties might work well enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants