Use content= kwarg of httpx instead of data=
Apparently, data=
attempts to upload everything in one chunk, so if a
generator produces a multi-gigabyte payload, it will be reassembled in
memory at once instead of being streamed. Also, data=
may apply
transformations to the data (e.g. it can be passed a dict to send form
data), and is deprecated for binary data.