how to send image to server by post to http?

Hi Ibrahim, if I want to add readline function to the socket module on OpenMV what should I do, is socket inside firmware?

def readline(self) -> bytes:
    return self.readuntil(b"\n")

def readline(sock):
    "read a line from a socket"
    chars = []
    while True:
        a = sock.recv(1)
        chars.append(a)
        if a == "\n" or a == "":
            return "".join(chars)

Btw I get OSError: -12 error.
I tried wipy code too, it had errors too, will work on both approaches over weekend…

Thanks

None of the libraries above work out of the box or support sending files, I’ve spent most of the day fixing errors, adding support to send files and testing. If you’re still having problems with this I can’t help you, I just don’t have any extra time to work on this.

Updated library: openmv/urequests.py at master · openmv/openmv · GitHub
Example: https://github.com/openmv/openmv/blob/master/scripts/examples/OpenMV/14-WiFi-Shield/http_post.py

1 Like

I see, really thank you Ibrahim for your help and time, I was able to upload from OpenMV to my website with a bit of modification on my website PHP(extracting the image from array). I am so happy it works now! :grinning:

Hopefully, a lot of people will use urequests on OpenMV and it will be popular as requests is for Python!
I am practicing programming more not to bother you guys much!

Thanks,
MoZen

Great to hear.