Home > Blockchain >  Make a python server receive files sent using curl
Make a python server receive files sent using curl

Time:09-16

I want to make a python script that would run a server which I can then send a request to from another pc using curl to send a file. So I would send a file from a pc to the server using curl and then server would save that file.

I tried googling but couldn't seem to find anything like that, but I found that pycurl might be useful. If anyone could show me the direction towards my goal I would appreciate it.

CodePudding user response:

Sending files is typically just a POST with data. You can make a webserver using something such as flask, and make an endpoint that receives post data, then saves it as a file. On the server, you don't need curl at all, just an HTTP server that accepts requests.

CodePudding user response:

You can use http.server in the standard library... https://gist.github.com/mdonkers/63e115cc0c79b4f6b8b3a6b797e485c7

  • Related