As a Python project, I would like to control Google Hangouts (start/end video/phone calls, mute/unmute, dial a key, etc) using Python 2.7; e.g. create a call() function that accepts email addresses and phone numbers of people in my circles/contacts and call those people.
As a newbie, however, I don't know whether:
There is already a Python package that does (most of) that,
I need to sign up for Google Cloud, install Google Cloud SDK, learn
how to use the Google App Engine, etc. or just being logged into Google in a browser is sufficient
So, I'd appreciate if someone could sketch a brief road map for me.
For example, what Python packages do I need?
Hangups, a python instant messaging client for hangouts already exists and is probably worth a look. It's a terminal client, but it is also used as a back-end for several GUI applications.
https://github.com/tdryer/hangups
Related
I have python code that uses Gmail API for fetching unread emails and adding labels according to some rules.
The code runs on my computer and I wish to create a Gmail add-on for this labeling, the add-on should include a new button in the Gmail interface.
The problem is that Google add-on uses google app script.
I want to ask if there is a possibility to embed my python code into the google app script?
Thanks :)
You might use Python with Google Apps Script API to programmatically create and modify a Google Apps Script project, but the Google Apps Script uses V8 as it's runtime, and it requires JavaScript.
You might use Google Cloud Run (see https://cloud.google.com/run/docs/quickstarts/build-and-deploy/deploy-python-service) or another hosting infrastructure to use Python to use the Card Service to build the add-on user interface and use the Gmail API.
I think that it might be possible to use Google Colaboratory as the hosting infrastructure but I have no idea how convenient it will be compared to use Google Cloud Run.
I am new to using firebase so I was looking to see if it was possible to call a python script in firebase to manipulate an image.
I have already written a python program that takes an input image and processes it and returns a new image. I would like to extend this where a mobile or web app could send a user-provided image, to the database, the python program would run and the app would show the processed image.
I assume that a REST API could handle this but my question is if I could run the python script over the cloud. I know firebase has a cloud run function but I have never touched it. Please let me know if there are any resources for this or any alternatives.
Although Firebase Functions can be written only in JS or TS they are part of Google Cloud Function. If you create the function in Firebase you will see it as well in Functions in Google Cloud Console.
So it's practically the same feature, however GCP gives you possibility to write cloud functions in many languages (currently 7, I think). Among them you can use Python
in version 3.7, 3.8 and 3.9 (currently in beta).
You can use GCP GUI to write the functions or use Cloud SDK (gcloud functions deploy) to create the function. Nice examples are in mentioned documentation.
Additionally the Cloud Function has nice choice of triggers including Firebase related.
I'm not a newbie when it comes to python (nor a professional), but this is the first time I'm trying something like this.
I would like to upload files to OneDrive using an python script. Sounds simple right? Well apparently it's more then I can handle.
From what I've seen so far the onedrive-sdk-python I was using apparently doesn't work anymore (source: https://github.com/OneDrive/onedrive-sdk-python/issues/119) because it's being decommissioned.
The new SDK to use is the one for Microsoft Graph I guess? But the github (https://github.com/MicrosoftArchive/msgraph-sdk-python) doesn't really mention how to set up the new Oauth2 authentication, get a token and use the client in python. The links mentioned in the authentication section don't work for me, I get error messages like: "AADSTS900144: The request body must contain the following parameter: 'client_id'."
I looked on stackoverflow for similar questions but most of them are about the old onedrive-sdk and the most recent one I could find was almost 3 months old. The response there was that it was still under development.
I guess the problems I've been having are all related to the Microsoft Graph still being in development, but I was wondering if someone managed to get it to work and if they could point me in the right direction to get the authentication setup and getting me started on uploading files to OneDrive.
Some details in case it matters:
Rasbian 9 Stretch
Python 2.7.13 & Python 3.5.3 (tried both)
OneDrive business account
Many thanks to anyone who can point me in the right direction :)
I'm afraid the SDK you're using is no longer being actively maintained. From the ReadMe:
This library is no longer actively supported. To integrate Microsoft Graph into your Python solution, we recommend using REST and taking a look at our new Python samples and documentation.
To answer your question on tokens, these are not technically issued by Microsoft Graph. They're issued by Azure Active Directory (or Outlook.com for personal accounts). You obtain a token using OAuth 2.0.
You are, however, on the right track. Before you can do anything with Microsoft Graph, you're going to need to obtain an OAuth token. The good news here is there's a sample Python project that walks you through how this process works: Python authentication samples for Microsoft Graph.
Can Google Cloud Functions handle python with packages like sklearn, pandas, etc? If so, can someone point me in the direction of resources on how to do so.
I've been searching a while and it seems like this is impossible, all I've found are resources to deploy the base python language to google cloud.
Python 3.7 is supported now.
Steps to create one via the google cloud console:
go to google cloud functions in the google cloud console and click on create function
2.specify the function's properties
select trigger
4.change runtime to python 3.7
enter your cloud function logic and entry point
enter python dependencies in requirements.txt
EDIT: As of July 2018 there is now a Python runtime (3.7) available for Google Cloud Functions!
OLD ANSWER: Google Cloud Functions (GCF) are written in JavaScript (executed in a Node.js runtime), so there is no way for them to actually handle Python at this moment. There is a Python module at GitHub that you might have come across and it can be used to write and deploy GCF with one of three trigger types: http, Pub/Sub and bucket. The module takes care of translating your Python logic to a JavaScript code that is later run inside Google Cloud Platform.
When it comes to other packages like pandas, the ‘translation’ into JavaScript was not prepared for them by anyone AFAIK. If you really don’t like the idea of jumping into JavaScript and writing the Cloud Function code on your own (with the logic you intended to use in a Python script), you have a possible workaround. You can evoke your Python script from inside of the Cloud Function written in JS - the idea was discussed in this topic. Another way is using Object Change Notifications or Pub/Sub Notifications as explained here.
As of 19th July 2018, Google Cloud Functions supports Python 3.7.
Kindly check the Runtime environment to find the Python 3.7 runtime and sample script (based on Flask) .
--UPDATED--
Official Documentation for the Google Cloud Functions - Python 3.7 support Beta Release.
This is a beta release of the Python runtime for Google Cloud
Functions. This feature might be changed in backward-incompatible ways
and is not subject to any SLA or deprecation policy.
SkLearn, Numpy is supported in Google Cloud function. Also I've run a sample test to confirm the availability of Pandas as well and its working fine.
https://github.com/mkanchwala/google-functions-python-example
Hope this helps to all the "Py" lovers.
You can use AWS lambda as well if you want to work around and still use Python as your main language. Some modules/packages will need to be imported via zip file with AWS Lambda but it has a broader range of usable languages than GCF
I have developed a few python programs that I want to make available online.
I am new to web services, and I am not sure what I need to do in order to create a service where somebody makes a request to an URL (for example), and the URL triggers a Python program that displays something in the user's browser, or a set of inputs are given to the program via browser, and then python does whatver it is supposed to do.
I was playing with the google app engine, which runs fine with the tutorial, and was planning to use it becuase it looks easy, but the problem with GAE is that it does not work well (or does not work at all) with some libraries that I plan to use.
I guess what I am trying to do is some sort of API using my WebFaction account.
Can anybody point me in the right directions? What choices do I have in WebFaction? What are the easiest tools available?
Thank you very much for your help in advance.
Cheers
Well, your question is a little bit generic, but here are a few pointers/tips:
Webfaction allows you to install pretty much anything you want (you need to compile it / or ask the admins to install some CentOS package for you).
They provide some default Apache server with mod_wsgi, so you can run web2py, Django or any other wsgi frameworks.
Most popular Python web frameworks have available installers in Webfaction (web2py, django...), so I would recommend you to go with one of them.
I would also install supervisord to keep your service running after some reboot/crash/problem.
I would be glad to help you if you have any specific question...