> > On 3 Nov 2020, at 01:03, 'Jose Henrique S Junior' via cherrypy-users <cherryp...@googlegroups.com
> > Now I am trying to respond to a GET query, with a list of responses, and some files attached
> > to each of those responses. I've been looking on the internet for it, but I must not be using the
> > right words on my search, because I haven't got any hits.
вт, 3 лист. 2020 о 10:37 David Allouche <da...@allouche.net
as David wrote, it's important to understand how HTTP works,
especially given that CherryPy is
a microframework where you're working with low-level stuff more than
in high-level frameworks.
It sounds like you want to implement a list operation typical to CRUD.
The way it's usually solved
is implementing some sort of and API that responds with structured
data like JSON (see
also REST). When the client sends an API request over HTTP, it gets a
list of pointers to files
(often accompanied with some extra metadata like names/dates etc.)
Then, the client parses that list, extracts the URLs to files, and
issues a series of separate
subsequent HTTP requests in order to download those files.
Of course, it's technically possible to embed files into that first
HTTP response but it's not really
common. You could pack different chunks of data using the multipart
MIME type or come up
with your own serialization for embedding the data. Although, be
prepared to implement proper
parsing on the client.
P.S. It'll still be one HTTP response to one HTTP request. Be aware
that CherryPy supports
HTTP/1.1 and not HTTP/2. So when you'll learn about HTTP, make sure
you understand how
this version works.
() ascii ribbon campaign - against html e-mail
- against proprietary attachments