Comments (13)
Thank you @deckerego! I will give this new feature a try, but it might be a few weeks before I can get to it.
from ampule.
Multipart/MIME file uploads and downloads aren't available yet, but I'll look into adding that as an enhancement this week.
from ampule.
Perfect. FYI, the application where I would like to use file transfer over http is a wifi-connected Adafruit MLX90640 IR camera connected to an Unexpected Maker FeatherS2 ESP32S2 that I want to run as a remote wildlife camera. I may also try sending the IR camera frames over RFM95 radio transceiver, but I thought that sending over wifi might be an easier implementation.
from ampule.
@jmangum - are you planning to get the raw byte array from the camera driver, and then convert & send the file in-memory? That's the approach I'm looking at right now at least - providing a method to return a raw byte array with a supplied MIME type.
from ampule.
I was planning on using the CircuitPython library to grab the image from the camera and send these image data as a file that I could then transfer via HTTP. Did not plan on doing this in memory.
from ampule.
Could you point me to the library methods you were thinking of using to fetch the image? I'd like to review the return types and build an example & tests that match your use case.
from ampule.
The CurcuitPython library I use to read the MLX90640 is located at https://github.com/adafruit/Adafruit_CircuitPython_MLX90640.
from ampule.
Sure, but that seems to return a collection of integer values for infrared intensity rather than an image, correct? What functions would you call to return an image?
from ampule.
Correct. I can export this list of floats to a file which I can then transfer using your library. I then use another python script to generate an image from the list of floats (temperatures). This was why my original suggestion was that the general ability to transfer files would be useful.
from ampule.
Ah - gotcha. Thx for explaining @jmangum
For that particular use case I'd recommend serializing your floats into a JSON or plaintext response, then sending that response instead of sending a file. You could easily do that today using the Content-Type application/json
or text/plain
- you could either use the built-in JSON libraries within Python to convert an in-memory object, or you could manually build a string and send that in plaintext if you like.
I'm still going to work in allowing you to send binary data as a response (e.g. b'1234'), but for your particular use case I think you can get rolling with the current release.
from ampule.
@jmangum - I have a test version of ampule available in the pull request linked to this issue - feel free to try it out and let me know if that works. You will need to set the Content-Type
accordingly if you output bytes instead of a string.
from ampule.
@jmangum - an updated version has been pushed to the file_download
branch with fixes for the ESP32-S2. Feel free to give the updated version a whirl.
from ampule.
Thank you @deckerego. I think that you can close this issue.
from ampule.
Related Issues (10)
- ERR_CONTENT_LENGTH_MISMATCH on long response strings HOT 2
- Error with request: name 'bytes_sent' is not defined HOT 2
- Just a small syntax error in example HOT 3
- ETIMEDOUT
- Ampule download file from webserver example HOT 2
- How to use with MicroPython? HOT 1
- Non-blocking behaviour HOT 4
- How to i set this to service files from a directory HOT 1
- Adafruit AirLift HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ampule.