简体   繁体   English

在Firebase中定期运行python程序作为后台服务

[英]Periodically run a python program as a background service in firebase

Just start using the firebase + react to build a website. 刚开始使用Firebase + React建立网站。 One of the designed features of my website is to crawl and show users the data parsed from another website (eg, the stock price changes). 我网站的设计功能之一是对从另一个网站解析的数据进行爬网并向用户显示(例如,股价变化)。 I already have a python crawler responsible to parse the data, but I have no idea how to execute this python crawler (in the background) of my server in firebase (or it is not even possible)? 我已经有一个负责对数据进行解析的python搜寻器,但是我不知道如何在firebase中执行服务器的python搜寻器(在后台)(或什至不可能)?

Here is the example usage of my system 这是我的系统的示例用法

  1. user login and subscribe the website/data they are interesting 用户登录并订阅他们感兴趣的网站/数据
  2. my crawler will parse that website every 1 hour and update the data to database 我的搜寻器会每1小时解析一次该网站,并将数据更新到数据库中
  3. user can see the summary of change of website from database 用户可以从数据库中看到网站变更的摘要

One option I have in mind is running the crawler in my local machine and use the REST api to update the parsed data to firebase database. 我想到的一个选项是在本地计算机上运行搜寻器,并使用REST API将已解析的数据更新为firebase数据库。 However, it seems a very inefficient/naive approach because it is kind of losing the meaning of deploying my server with cloud service, like firebase. 但是,这似乎是一种非常低效/幼稚的方法,因为它失去了使用Firebase等云服务部署服务器的含义。

Firebase does not have any service/feature that allows you to periodically run Python or any other code. Firebase没有任何服务/功能可让您定期运行Python或任何其他代码。 The closest thing to that is Cloud Functions, which can be triggered through an external service like cron-job.org. 最接近的是Cloud Functions,可以通过cron-job.org等外部服务来触发。

For more in this, see: 有关更多信息,请参见:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM