How to run a python script on images present in firebase? - python

I have a image in my firebase acccount and I want to run a python script on this image and get a result back.
Can someone suggest me a simple way to do this?
I tried hosting the python file in heroku. Fetching the image from firebase to heroku and running the python script would be an overhead.
Is there a simpler way to run the python script in firebase itself?

There are a handful of Python wrappers for Firebase but some have not been updated in awhile. Try this Getting Started with Pyrebase, then try this tutorial for Getting started on Heroku with Python.

Related

Is it possible to display a python result with react?

I want to write a program using python as logic, because of the extensive libraries available in python suited for this project, and to develop the UI using react.
Is this at all possible, or is there a different method which is easier?
if you want to use react as a front end for a website, you could run python as the back end using something like flask or Django. Python can't be run in the browser, you'll need to run python on a server or run in locally on your machine if the project is just for you.

Firebase Cloud Functions running a python script - needs dependencies

I'm building a website with React and Firebase that utilizes an algorithm I wrote in python. The database and authentication for the project are both handled by Firebase, so I would like to keep the cloud functions in that same ecosystem if possible.
Right now, I'm using the python-shell npm package to send and receive data from NodeJS to my python script.
I have local unit testing set up so I can test the https.onCall functions locally without needing to deploy and test from the client.
When I am testing locally, everything works perfectly.
However, when I push the functions to the cloud and trigger the function from the client, the logs in the Firebase console show that the python script is missing dependencies.
What is the best way to ensure that the script has all the dependencies available to it up on the server?
I have tried:
-Copying the actual dependency folders from my library/.../site-packages and putting them in the same directory under the /functions folder with the python script. This almost works. I just run into an issue with numpy: "No module named 'numpy.core._multiarray_umath'" is printed to the logs in Firebase.
I apologize if this is an obvious answer. I'm new to Python, and the solutions I've found online seem way to elaborate or involve hosting the python code in another ecosystem (like AWS or Heroku). I am especially hesitant to go to all that work because it runs fine locally. If I can just find a way to send the dependencies up with the script I'm good to go.
Please let me know if you need any more information.
the logs in the Firebase console show that the python script is missing dependencies.
That's because the nodejs runtime targeted by the Firebase CLI doesn't have everything you need to run python programs.
If you need to run a function that's primarily written in python, you should not use the Firebase CLI and instead uses the Google Cloud tools to target the python runtime, which should do everything you want. Yes, it might be extra work for you to learn new tools, and you will not be able to use the Firebase CLI, but it will be the right way to run python in Cloud Functions.

Getting inside a Openshift container using Ansible/Python

I was trying to automate the process of getting/copying a file from a POD to the jump node of an Openshift cluster(not using the rsync command). I tried to find any suitable ansible module for this but failed and tried to create a python script also but not sure how will I manage the authentication part. So if you have any example repo/website from where I can get an idea on how to write a python script for this or any official Ansible module that is suitable for this task please let me know. Thanks.

Flask does not work on Amazon Lightsail with ICS package

I try to write my first Web app using python and flask (Disclaimer: Sorry in advance for wrong terminology and not knowing obvious stuff). Testing the code on my laptop and everything works fine.
I tried to deploy it on Amazon Lightsail for the first time using this guide, because I used it throughout the development.
I tried to use flask run and flask db upgrade, but I get for both the following error message:
File "/home/ubuntu/app/venv/lib/python3.5/site-packages/ics/alarm/audio.py", line 31
self._sound: Optional[ContentLine] = None
This error does not occur on my local machine with the same code (I recommited the git code). I looked in the files on the server, but could not find a mistake.
This is my first big coding project. What would be the next steps in debugging?

Hosting a Mongo DB with a scheduled Python Script

I'm looking for a hosting service to run my python scripts. My python scripts take info from various API's and put them into a Mongo database. I'd like to schedule them so that they run once an hour. Right now I'm running python 2.6 and using a couple of extra packages like facebook sdk and python twitter tools. I've been looking into heroku, but I'm new to the service and I'm having trouble finding documentation on heroku and python. The other service that I came across is MongoHQ, but I'm unsure as to how that works with Python. Do you know of a hosting service that would be compatible with all of these things?
EDIT
I took the advice below and explored DotCloud a bit. For anybody who's a newb like I am, I wrote a post on it on my blog (swootsblog.cloudfoundry.com) which I hope is pretty easy to follow along with. It's a continuously running python script writing to a MongoDB all set up on DotCloud.
Heroku doesn't run Python, they only run Ruby, Node.js, Clojure and Java.
There might be other services, but I've played around with DotCloud which has a python worker type for exactly this sort of work.
Heroku Does runs python scripts, I have previously done this with python to postgres database,
Pre-req
pythonscripts.py
procfile
requirements.txt
and After add, commit and push the scripts to heroku app. Just run the following command on terminal to run the scripts.
heroku run python your_scripts.py
More if you want to run this scripts on a schedule timing. then heroku provides lots of adds-on. just search it on heroku
If you need more help, make a chat with me.

Categories

Resources