Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
google-api-v3-helper
Advanced tools
help python developper to use some of the Google Drive API v3 easily
Detailed usage documentation is still in progress The objective of this package is to help python developper to use some of the Google Drive API v3 easily. As of now, 5 functions are available. This package is embedding very nicely with Google API libraries.
This is how you can install it on your machine:
pip install google_api_v3_helper
All of the functionnalities of google_api_helper require you to build the the service class using google ServiceAccountCredentials. For instance, you can use the ServiceAccountCredentials from json keyfile name as such:
from googleapiclient.discovery import build
from oauth2client.service_account import ServiceAccountCredentials
def get_service():
scopes = ['https://www.googleapis.com/auth/drive'
, 'https://www.googleapis.com/auth/drive.file']
key_file_location = 'pathtokeyfile.json'
creds = ServiceAccountCredentials.from_json_keyfile_name(key_file_location, scopes=scopes)
service = build('drive', 'v3', credentials=creds)
print('connection OK')
return service
service = get_service()
Once set, you can use our library and get, for instance, the folder tree of a specific file as such:
from google_api_v3_helper import find_google_fileid_tree
fileId = 'XXXXXXXXXXX' #id of the file you wish to get the folder tree for.
tree = find_google_fileid_tree(service, fileId)
Get folder id of a folder in Google Drive
Arguments: service: in order to use any of this library, the user needs to first build the service class using google ServiceAccountCredentials. folder_name: name of the folder you wish to get the ID of.
Get a list of folders in a folder in Google Drive
Arguments: service: in order to use any of this library, the user needs to first build the service class using google ServiceAccountCredentials. folder_id: id of the folder you wish to get the folders list of.
Get a list of files and folders in a folder in Google Drive
Arguments: service: in order to use any of this library, the user needs to first build the service class using google ServiceAccountCredentials. folder_id: id of the folder you wish to get the folders list of.
Upload a file in a folder in Google Drive
Arguments: service: in order to use any of this library, the user needs to first build the service class using google ServiceAccountCredentials. MediaFileUpload: function of oauth2client.service_account. see www.pypi.com for a full example. parent_id: id of the folder you wish to get the folders list of. file_name: local path to the file. If the file is in the same folder as your script, then you should only enter here the name of your file.
Find the folder tree of a file
Arguments: service: in order to use any of this library, the user needs to first build the service class using google ServiceAccountCredentials. fileId: id of the file you wish to get the tree for.
FAQs
help python developper to use some of the Google Drive API v3 easily
We found that google-api-v3-helper demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.