-
Notifications
You must be signed in to change notification settings - Fork 192
how to pass a file and body at same time? #410
Comments
Shouldn't you be using POST instead of GET to send a body? Also, note that |
ahh sorry about that im forgot this one, but you can explain me how to pass valid argument for POST method pass a file and some data(body)? |
I am also having some issue with POST. here is my sample code. filepath = "testfile" files = {'image', a} hdr = {'Content-Length': str(file_size)} |
This part of the docs provides an example POST request: from hyper import HTTPConnection
c = HTTPConnection('http2bin.org')
req = c.request('POST', '/post', body=b'hello') As you can see, |
i know about this one, but how if i want post image import requests
fr = {
"a":open("tes.jpg", "rb")
}
r = requests.post("https://api.ians.web.id/api/img/index.php", files=fr)
print(r.text) and i get what i want, im so glad if have example using hyper for my issue |
Currently there is no way to do this in hyper. There are two ways I can see this being resolved:
For the time being, in theory I reckon you could just use the requests method I listed to encode the data yourself and pass that to hyper in the body? I'm not sure what the thoughts of the repo owner are on re-using requests stuff to implement functionality but I don't see a reason not to |
i've new in
hyper
i want just send request using file for a body but i didn't get valid argument for thislet say i have code like this:
i dont know how to pass my file into request argument, so many appreciate for any help
The text was updated successfully, but these errors were encountered: