N
N
Nastas2014-10-13 17:26:57
Flask
Nastas, 2014-10-13 17:26:57

How to start a service that constantly polls other services via api?

Hello. I'm making a service in python that constantly polls the google calendar and, when it changes, performs certain manipulations with e-mail.
In parallel, the database of this service needs access via the web in order to see the chronology of changes.

Do I understand correctly that the easiest way to implement this is to buy a VPS, open two command lines there and run one script from one (which polls the Google calendar every N seconds), and from the other, start the Flask server, and both scripts attach to a single database?

I am not familiar with parallel programming, I only know the basics of Flask. And I still don't understand how to write a function that does not end with rendering an HTML page. If it really can be done without reading 400 pages of documentation, please provide a link to the tutorial.

Thank you!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dmitry Entelis, 2014-10-13
@DmitriyEntelis

If N is at least a minute or more, then the script that queries the Google calendar can and should be run by cron.

V
Valentine, 2014-10-13
@vvpoloskin

You can poll with your hands, you can entrust this to the webdav protocol and the console client (google is still working with it), you can try to come up with something with push notifications ...
And at the expense of multitasking, you don’t need to poll the calendar from a web application. Just make your own daemon (or a cron script?) that will take care of calendar processing and writing changes to the database.

R
Ruslan Luxurious, 2014-10-23
@oshikuru

Regarding the parallel operation of scripts - look towards celery - a good thing that allows you to run independent workers with tasks.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question