On the page of snapd REST API, it shows how to sideload a snap by sending request.
However, I am not clear what is the value for the key of the filename. The example shows as the following:
Content-Disposition: form-data; name=“snap”; filename=“hello-world_27.snap”
<20480 bytes of snap file data>
–foo
I am assuming I need to read the snap file as a byte stream and decode it as a string. Then use this string to replace <20480 bytes of snap file data>.
I tried to decode it as “utf-8”, I got the following error:
UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xf8 in position 9: invalid start byte
Can anyone tell me I am on the right path and how to do it?
that error is in your own code, which apparently is in python, so without knowing exactly what you’re doing it’s nigh impossible to tell what you’re doing wrong.
I’d suggest that, unless you know what you’re doing, you don’t try to write it by hand. Use libraries like requests (and requests-unixsocket) to do the work for you.