How to access Google Docs using Python - python

For Google Spread Sheet, gsperad is a great tool to access, modify and retrieve Google SpreadSheet.
Is there a tool for Google Docs, to access and modify Googel Docs document in Python?
Thank you very much

Google has a Google Doc API for use with Python. Please refer to the following links for more information:
Drive API Client Library for Python
Quickstart: Run a Drive App in Python

Related

How to disable gcp services by using python (client library files)?

I can able to disable GCP services via gcloud by using gcloud services disable storage.googleapis.com. but i need to achieve via python client library files (reference), I searched but no luck. For Authentication i have credentials.json file. do we have any way ? can any one suggest me the code or reference document or site pl?
I believe you referenced the wrong documentation, here is the Python SDK documentation you should look at: https://googleapis.github.io/google-api-python-client/docs/dyn/serviceusage_v1.services.html#disable
Something similar as below (haven't tested it):
client = discovery.build('serviceusage', 'v1', credentials=credentials)
svc_name = "projects/123/services/serviceusage.googleapis.com"
operation = client.services().disable(name=svc_name).execute()

Is there a way to modify google document with python script?

I am using python and writing a script to create a google document with PyDrive, upload it to google drive and modify the document as well. I am following the instructions from pydrive documentation (https://pypi.org/project/PyDrive/).
So far, I am able to create a document, upload/download and set permissions. I am looking for other capabilities from pydrive like modifying the document, adding paragraph, set font or insert table from the python script. I see all this in python-docx (https://python-docx.readthedocs.io/en/latest/). Do we have this in google drive api using pydrive as well?
I am able to achieve this using google doc APIs as suggested. Reference to this is developers.google.com/docs/api/how-tos/documents
Google doc API

What Google app engine Auth to use to only expose my "intranet" site only to my GSuite users?

I am pretty new Google app engine, and though I have hacked around with alot of languages, I am finding the google documentation a little overwhelming. I have successfully launched a static site, and successfully run some python code from the console. But I have not run any python from my static site.
I am a Small company trying to setup a google app engine static/dynamic website that I only want to expose to my Gsuite users.
I have some python code I want to run on my app engine, which will download a file from gdrive/teamdrive, process the file, create a new file from the results and then upload the resulting file to the same folder.
I may also at a later date have this static/dynamic website also interfacing with Cloud SQL(mysql) or an external database.
my Questions
What authentication method to use to only expose this website to my gsuite users?
Though I have worked through some of the GDrive api examples whats the best and easiest method of passing GDrive text files to my python code? (though I have hacked around with python lots in the past, the html and python combination perplexes me)
Thanks!
You would use OAuth2.0 to acquire a token which you can then use to interact with that user's files through the GDrive API (see "About Authorization" as well as this quickstart Python example).

Python client for Google Container Engine API

I'm working on a project where I need to create and manage clusters, pods, services and deployments on google container engine.I have googled a lot to find an API for that, Google's Container engine REST API is available, is there any python client for that API? what I need exactly.
Help me, please!
Thanks in advance!
On this page you can find information about using Python including installation of the client library and
Google Container Engine API: The Google Container Engine API is used
for building and managing container based applications, powered by the
open source Kubernetes technology.
This page contains information about getting started with the Google
Container Engine API using the Google API Client Library for Python.
In addition, you may be interested in the following documentation.
More generally there is this page about Google APIs and Python libraries and a getting started using Python in GCE example on Github.

Upload Files To Google Cloud Storage With Google App Engine (Python)

I'm trying to set up a basic python-based google app engine site that allows users to upload files to google cloud storage (mostly images)
I've been going through the documentation for the JSON API and the GCS client library overview (as well as blobstore etc) and still don't have a good handle on which is the best method and how they are related. Would be great if someone could give an overview of this or point me to some resources I can check out
Also, any sample code that's relevant would be really helpful. I've been able to run the upload samples here but not sure if they're useful for an app engine setup: https://github.com/GoogleCloudPlatform/storage-file-transfer-json-python
Thanks!!
Google Cloud Storage has two APIs -- the XML API and the JSON API. The XML API is XML based and very like the Amazon S3 API. The JSON API is similar to many other Google APIs, and it works with the standard Google API client libraries (for example, the Google API Python library). Both of these APIs can be used from anywhere, with or without App Engine, and are based on RESTful HTTP calls.
App Engine provides a couple of standard ways to access Google Cloud Storage. The first is built into App Engine's API as a feature called the "Google Cloud Storage Python API". This does not directly use either the XML or the JSON API. It's deprecated and no longer recommended.
The second App Engine library is called the "Google Cloud Storage
Python Client Library" and is not part of the core App Engine API. Instead, it's a Python library put out by Google that you can download and add to your application like any other library. This library happens to be implemented using the XML API. It provides a few extra features that are useful for App Engine users, such as the ability to serialize an upload while it's in progress. There's an example of using this library included as part of the download, in the python/demo directory. You can also see it online.
Equivalents of these tools also exist in Java and Go.
There's no need for users to use the App Engine-specific libraries unless they find them to be useful. The standard Python library or even just hand-written HTTP calls using urlfetch will work just as well. The App Engine library merely provides some useful extras for App Engine users.
App Engine also have a "Blobstore Python API". This is a feature specific to App Engine and distinct from Google Cloud Storage, except that it provides a few hooks into Google Cloud Storage, such as the ability to store files in Google Cloud Storage using the Blobstore API.

Categories