adafruit / Adafruit_CircuitPython_Requests

Requests-like interface for web interfacing
MIT License
51 stars 36 forks source link

Add ability to post a file via the data param #194

Closed justmobilize closed 1 week ago

justmobilize commented 2 weeks ago

Add ability to post a file via the data param

jmangum commented 1 week ago

Tested @justmobilize solution with a Pico W/OV5640 PiCowbell/PiCowbell doubler setup which posts jpeg to Adafruit IO with feed history turned-off. Works perfectly! Due to memory limitations have to reset board (I actually put it into a TimeAlarm deep sleep) after each picture acquisition and upload, but this is a small price to pay (and probably a more sensible solution for an application that one might want to run with a battery).

A couple of important implementation notes:

  1. Using 640x480 image size
  2. Could not use cam.quality less than 11 (otherwise run out of memory)

Thank you @justmobilize !

jerryneedell commented 1 week ago

Is there an example for using this? I'd like to give it a try, but I'm not sure how to use it.

jmangum commented 1 week ago

Sure thing @jerryneedell . Attached is my test code. Very much a work-in-progress, so please excuse the awful code. It does work as I have repeatedly posted pictures to aio. code_iotfeeder.py.txt

justmobilize commented 1 week ago

@jerryneedell here is the test code I used (just used an existing file): https://gist.github.com/justmobilize/f0ee9668d7aab6d91524b3ab53953d2c