0

I would like to do a very simple thing but I kept having trouble to get it work.

I have a client and a server. Both of them have python. The client needs at a certain time in the python code to send a picture to the server and the server is using python to receive the picture, to do some modifications in the picture then save it to disk.

How can I acheive this the easiest way possible? Is Django a good idea?

My problem is that I keep getting an error from the Django server side and it seems it is because I am not managing the cookies.

Can someone give me a sample code for the client and for the server to authenticate then send the file to the server in https?

Also, if you think it is best to use something else than Django, your comments are welcomed :). In fact I managed to get it work very easily with client python and server php but because I have to treat everything in python on the server, I would have prefered not to install apache, php, ... and use only python also to get the picture.

Many thanks for your help,

John.

user2040597
  • 469
  • 3
  • 8
  • 21
  • Are you planning on having a webui, or will your application require the client software in order to interact with the server? – Garrett Hyde Nov 27 '13 at 19:22
  • I don't really need a webui. I really only want to get authentication through https then just sending the file from client side, receiving the file on the server then execute some python commands on the file then save it to disk. No need to get access to it via browser or things like that. – user2040597 Nov 27 '13 at 19:32
  • If you want to build a RESTful web service in Python, checkout [this question](http://stackoverflow.com/questions/713847/recommendations-of-python-rest-web-services-framework). – Garrett Hyde Nov 27 '13 at 19:32
  • Why are you using https? If you want your connection to be encrypted, you can [create a socket](http://docs.python.org/2/howto/sockets.html#creating-a-socket) and [use ssl](http://docs.python.org/2/library/ssl.html#ssl.wrap_socket). – Garrett Hyde Nov 27 '13 at 19:37

1 Answers1

0

You don't need Django - a web framework - for this unless you really want to have the features of Django. (Here's a good link. But to sum it up, it would be "a bunch of website stuff".)

You'd probably be best off just using something to transmit data over the network. There are a lot of ways to do this!

If your data is all local (same network) you can use something like ZeroMQ.

If you are not sure if your data is local, or if you know it won't be, you can use HTTP without a server - the Requests library is awesome for this.

In both these scenarios, you'd need to have a "client" and a "server" which you already have a good handle on.

Garrett Hyde
  • 5,409
  • 8
  • 49
  • 55
Ryan O'Donnell
  • 617
  • 6
  • 14
  • I am already using python-requests from the client side. On the server side I am using a php webpage. But as I said, I would rather not have a webserver as you say but just receive the file over https after authentication. I think python requests can only work on the client side right? – user2040597 Nov 27 '13 at 19:23
  • For something like this it should be acceptable to use the HTTP server built into Python: http://www.linuxjournal.com/content/tech-tip-really-simple-http-server-python – Ryan O'Donnell Nov 27 '13 at 19:32