Adding python code to firebase side - python

We have an app which is created with Ionic. We used firebase as backend. All authentication and couple of things handled by firebase. We have two major things which are done by python. First we are scraping web for some data and can put it as direct Json file to firebase. Second we have to take some data from firebase, put it on some machine learning library methods and should have new data which again will be stored in firebase.
Question
How can I add python code which will be running periodicly in every 24 hours inside firebase for both scraping and machine learning scripts?
Confusion
I am not really familiar with server side like I would run python scripts in Apache server or not I have no clue. Since we started with firebase, I have to know how it is done. Python codes are actually ready. I checked python-firebase as well. Evenmore, I have put my machine learning data into firebase. But I do not know where to put this python code. Only thing that I have accomplished is firebase is capable of taking Json files with just one button. I would have not enough knowledge about server-side scripts as well.
Conclusion
If someone can enlighten me, I would deeply appreciate that.

Related

Creating a Google Sheets extension using Python

I am pretty new to Python, and I recently took on a project in which I am supposed to create a google sheets add on in python that edits that specific sheet when it is used.
https://developers.google.com/workspace/add-ons/guides/alternate-runtimes
I stumbled upon this tutorial, but I am very lost. I do not understand what "Pick your hosting infrastructure and set up your HTTPS endpoints" means, and I was able to follow steps 1-8 under "Create a Deployment Resource", but I was lost on step 9.
Could somebody help me with this task?
Picking your hosting infrastructure is saying to basically pick your server provider. Hosting just refers to servers because everything on the web needs to be hosted for everyone to access. HTTPS endpoints are urls that points to the location of resources in the server.
Step 9 was referring to creating a json file with information about your add on. I'm not particularly comfortable with JSON but from my understanding it's just using attribute:value pairs like CSS but it's used for storing and transmitting information.
Really hopes this helps, don't give up and dont get intimidated by this terminology. Best of luck!

How to run a server in the cloud

Im creating a server in Python that receives POST requests, process the information in the request using some scripts (sometimes using a database) and send back a answer in JSON format. Im searching for a way to run this server and code in the cloud, in a way that i dont need my PC turned on for it to work, because my connection is very unstable.
There are a lot of web hosting companies out there, you just need to find the one that is right for you.
My personal favorite for python apps is heroku, but there are many out there. AWS is another popular one.
In future when asking questions, try to do more research before hand, and try to be more specific with questions. It would have been useful to know what kind of database you are using, or whether you're using flask or django.

I was wondering if their is a way to return the number of NIC's installed in a machine and the amount of bandwidth alocated to each machine?

Here is a link to the code I have written so far. Eventually we are going to implement the code on the server and create a database. I am trying to pull in the most pertinent information I can to make things easier for our system administrators. As soon as I get some network information in the code, I am going to build out a database and then hopefully implement everything. Oh, here is the link to my pastebin code https://pastebin.com/8t69WeXv

Google apps python script

I want to be able to give out a form, with essentially 4 inputs. Each time it is submitted, I would it to trigger a python script.
I'm not totally sure where to start here. I could have the python code live on a server somewhere and have the google apps script trigger it, but ideally I could do this without having to host my code somewhere else. I also would like to avoid paying for anything...
Any and all advice would be appreciated. Please assume I have only a small amount of knowledge about this kind of stuff.
Check out this tutorial on the AppEngine documentation.
https://developers.google.com/appengine/docs/python/gettingstartedpython27/introduction
It will help you set up using Python and WebApp2 (for your forms!) and storing this data to datastore if you wish. You could just expand and modify the guestbook tutorial they make you do to have your application/script do exactly what you need it to. It's an excellent tutorial to get started even if you don't have much knowledge about python or appengine.

Python application communicating with a web server? Ideas?

I'm looking for a bit of web development advice. I'm fairly new to the area but I'm sure there are some gurus out there willing to part with some wisdom.
Objective: I'm interested in controlling a Python application on my computer from my personal web hosted site. I know, this question has been asked several times before but in each case the requirements were a bit different from my own. To reduce the length of this post I'll summarize my objective in a few bullet points:
Personal site is hosted by a web hosting company
Site uses HTML, PHP, MySQL, Python and JavaScript, the majority of everything is coded by me from the ground up
An application that is coded in Python will run on a PC within my home and will communicate with an Arduino board
The app will receive commands from the internet to control actuation via the Arduino, and will transmit sensor data back to the site (such as temperature)
Looking for the communication to be bi-directional, fast and secure
Securing the connection between site and Python app would be most ideal
I'm not looking to connect to the Python application directly, the web server must serve as the 'middle man'
So far I've considered HTTP Post and HTML forms, using sockets (Python app would run as a web server), an IRC bot and reading/writing to a text file stored on the web server.
I was also hoping to have a way to communicate with the Python app without needing to refresh the webpage, perhaps using AJAX or JavaScipt? Maybe with Flash?
Is there something I'm not considering? I feel like I'm missing something. Thanks in advance for the advice!
Just thinking out loud for how I would start out with this. First, regarding the website itself, you can just use what's easiest to you, or to the environment you're in. For example, a basic PHP page will do just fine, but if you can get a site running in Python as well, I'd prefer using the same language all over.
That said, I'm not sure why you would need to use a hosted website? Given that you're already forced to have a externally accessible PC at home for the communication, why not run a webserver on that directly (Apache, Nginx, or even something like CherryPy should do)? That webserver can then communicate with the python process that is running to control your Arduino (by using e.g. Python's xmlrpclib). If you would run things via the hosting company, you would still need some process that can handle external requests securely... something a webserver is quite good at. Just running it yourself gives you all the freedom you want, and simplifies things by lessening the number of components in your solution.
The updates on your site I'd keep quite basic: commands you want to run can be handled in the request handlers of the webserver by just calling the relevant (xmlrpclib) calls. Dynamically updating the page is best done by some AJAX calls I reckon. Based on your story, these updates are easily put in a JSON object, suitable for periodically updating only the relevant segments of your page.

Categories

Resources