Mink
Mink

Reputation: 448

Sending data through the web to a remote program using python

I have a program that I wrote in python that collects data. I want to be able to store the data on the internet somewhere and allow for another user to access it from another computer somewhere else, anywhere in the world that has an internet connection. My original idea was to use an e-mail client, such as g-mail, to store the data by sending pickled strings to the address. This would allow for anyone to access the address and simply read the newest e-mail to get the data. It worked perfectly, but the program requires a new e-mail to be sent every 5-30 seconds. So the method fell through because of the limit g-mail has on e-mails, among other reasons, such as I was unable to completely delete old e-mails.

Now I want to try a different idea, but I do not know very much about network programming with python. I want to setup a webpage with essentially nothing on it. The "master" program, the program actually collecting the data, will send a pickled string to the webpage. Then any of the "remote" programs will be able to read the string. I will also need the master program to delete old strings as it updates the webpage. It would be preferred to be able to store multiple string, so there is no chance of the master updating while the remote is reading.

I do not know if this is a feasible task in python, but any and all ideas are welcome. Also, if you have an ideas on how to do this a different way, I am all ears, well eyes in this case.

Upvotes: 1

Views: 486

Answers (4)

pylover
pylover

Reputation: 8075

I suggest you to use a good middle-ware like: Zero-C ICE, Pyro4, Twisted.

Pyro4 using pickle to serialize data.

Upvotes: 0

Colin Dunklau
Colin Dunklau

Reputation: 3111

Adding this as an answer so that OP will be more likely to see it...

Make sure you consider security! If you just blindly accept pickled data, it can open you up to arbitrary code execution.

Upvotes: 0

Kyle Johnson
Kyle Johnson

Reputation: 1675

Another option in addition to what Casey already provided:

Set up a remote MySQL database somewhere that has user access levels allowing remote connections. Your Python program could then simply access the database and INSERT the data you're trying to store centrally (e.g. through MySQLDb package or pyodbc package). Your users could then either read the data through a client that supports MySQL or you could write a simple front-end in Python or PHP that displays the data from the database.

Upvotes: 1

user147373
user147373

Reputation:

I would suggest taking a look at setting up a simple site in google app engine. It's free and you can use python to do the site. Than it would just be a matter of creating a simple restful service that you could send a POST to with your pickled data and store it in a database. Than just create a simple web front end onto the database.

Upvotes: 2

Related Questions