Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@ Workspace provides.
For select Google Workspace editions, admins can import sensitive files from
third-party storage using Client-side encryption and the
[Google Drive API](https://developers.google.com/drive/api/guides/about-sdk),
preserving the confidentiality of your data. Eligible admins can apply for beta
access using
[this form](http://docs/forms/d/e/1FAIpQLSfCROxYOykvmIiEx0X7rdsGqQwb4iXjc_PJVw83QGNHisgh0A/viewform).
preserving the confidentiality of your data.

In this package we are providing a code sample (in the form of a Python library)
to upload files hosted locally to Google Drive as Client-side encrypted (CSE)
files.

## Disclaimer

This sample is provided only to show how the basic logic can be implemented.
It’s not meant to be a production-grade working solution.

## Project Prerequisites

### Google Cloud
Expand Down
8 changes: 4 additions & 4 deletions drive_cse_upload/_cse_drive_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class CseDriveClient(object):

GOOGLEAPIS_URL = 'https://www.googleapis.com'

DRIVE_FILES = 'drive/v3beta/files'
DRIVE_FILES = 'drive/v3/files'
FILES_METADATA_URL = f'{GOOGLEAPIS_URL}/{DRIVE_FILES}'
FILES_UPLOAD_URL = f'{GOOGLEAPIS_URL}/upload/{DRIVE_FILES}'

Expand All @@ -47,7 +47,7 @@ class CseDriveClient(object):
'accept-encoding': 'gzip, deflate',
'user-agent': '(gzip)',
}
PARAMS = {'alt': 'json', 'supportsTeamDrives': 'true'}
PARAMS = {'alt': 'json', 'supportsAllDrives': 'true'}

SCOPES = ['https://www.googleapis.com/auth/drive']

Expand Down Expand Up @@ -93,9 +93,9 @@ def generate_cse_token(self, parent_id=None):
creds, http=self._http
)

params = self._new_params({'role': 'writer'})
params = self._new_params({})
if parent_id:
params['parentId'] = parent_id
params['parent'] = parent_id
url = f'{self.FILES_METADATA_URL}/generateCseToken?{urllib.parse.urlencode(params)}'
headers = self._new_headers({})

Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "drive-cse-upload"
version = "1.0.1"
version = "2.0.0"
authors = [
{ name = "Drive CSE Team", email="no-reply@google.com" },
]
Expand All @@ -17,7 +17,7 @@ classifiers = [
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Intended Audience :: Developers",
"Development Status :: 4 - Beta",
"Development Status :: 5 - Production/Stable",
]
dependencies = [
"tink>=1.10.0",
Expand Down