How to stream request body? #85
-
I have a server that accepts a streamed request body. How can I stream a local file to the server using this library? I see there's a function for streaming from Server to Local but not from Local to Server. This can be done using the folliwing: curl -X POST --data-binary @/path/to/large/file localhost:3000 In Python, this is done by passing the file handler to the with open(filepath, 'rb') as f:
r = requests.post(url, data=f) |
Beta Was this translation helpful? Give feedback.
Answered by
earthboundkid
Aug 8, 2023
Replies: 1 comment 2 replies
-
I’m on mobile, but you can use https://pkg.go.dev/github.com/carlmjohnson/requests#Builder.BodyReader or https://pkg.go.dev/github.com/carlmjohnson/requests#Builder.BodyWriter depending on the source. |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
gaby
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I’m on mobile, but you can use https://pkg.go.dev/github.com/carlmjohnson/requests#Builder.BodyReader or https://pkg.go.dev/github.com/carlmjohnson/requests#Builder.BodyWriter depending on the source.