Skip to content

wget Does not check for validity of headers prior to use #51

@samuelcomeau6

Description

@samuelcomeau6

In the event of an HTTP error, such as polling Adafruit IO api too often, the statement content_length = int(r.headers['content-length']) at line 638 is not valid which causes an unhandled exception.

Traceback (most recent call last):
File "code.py", line 33, in
File "code.py", line 29, in
File "adafruit_pyportal.py", line 845, in fetch
File "adafruit_pyportal.py", line 842, in fetch
File "adafruit_pyportal.py", line 838, in fetch
File "adafruit_pyportal.py", line 832, in fetch
File "adafruit_pyportal.py", line 638, in wget
KeyError: content-length
Code done running. Waiting for reload.
Auto-reload is on. Simply save files over USB to run them or enter REPL to disab
le.
Press any key to enter the REPL. Use CTRL-D to reload.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions