Skip to content

Commit

Permalink
Merge pull request #6 from octoenergy/support-all-drives
Browse files Browse the repository at this point in the history
Use new team drives arg instead of deprecated one
  • Loading branch information
ali-tny authored Aug 12, 2022
2 parents 4a761ef + dd5676e commit 6d5e19e
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 21 deletions.
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.0.3] - 2022-08-12
### Fixed
- Fix writing to shared drives by using the appropriate non-deprecated API parameter

## [0.0.2] - 2022-02-07
### Added
- Add click command for generating gdrive token
- Bump tentaclio install requirement >= 1.0.3

## [0.0.1] - 2021-11-26
### Added
- Google drive client.

[Unreleased]: https://github.com/octoenergy/tentaclio-gdrive/compare/0.0.3...HEAD
[0.0.3]: https://github.com/octoenergy/tentaclio-gdrive/compare/0.0.2...0.0.3
[0.0.2]: https://github.com/octoenergy/tentaclio-gdrive/compare/0.0.1...0.0.2
[0.0.1]: https://github.com/octoenergy/tentaclio-gdrive/releases/tag/0.0.1
14 changes: 0 additions & 14 deletions CHANGELOG.txt

This file was deleted.

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))

VERSION = "0.0.2"
VERSION = "0.0.3"

REPO_ROOT = pathlib.Path(__file__).parent

Expand Down
11 changes: 5 additions & 6 deletions src/tentaclio_gdrive/clients/google_drive_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def remove(self):
leaf_descriptor = self._get_leaf_descriptor()
args = {
"fileId": leaf_descriptor.id_,
"supportsTeamDrives": True,
"supportsAllDrives": True,
}
self._service.files().delete(**args).execute() # type: ignore

Expand Down Expand Up @@ -311,7 +311,7 @@ class _DownloadRequest(_GoogleDriveRequest):
def __init__(self, service: Any, file_id: str, writer: protocols.ByteWriter, **kwargs):
super().__init__(service, kwargs)
self.args["fileId"] = file_id
self.args["supportsTeamDrives"] = True
self.args["supportsAllDrives"] = True
self.writer = writer

def execute(self):
Expand All @@ -329,8 +329,6 @@ def __init__(
self, service: Any, name: str, parent_id: str, reader: protocols.ByteReader, **kwargs
):
super().__init__(service, kwargs)
# self.args["parents"] = [parent_id]
self.args["supportsTeamDrives"] = True
self.args["name"] = name
self.args["parents"] = [parent_id]
self.reader = reader
Expand All @@ -342,6 +340,7 @@ def execute(self):
self.service.files().create(
body=self.args,
media_body=media_body,
supportsAllDrives=True,
).execute()


Expand All @@ -353,7 +352,7 @@ def __init__(
):
super().__init__(service, kwargs)
# self.args["parents"] = [parent_id]
self.args["supportsTeamDrives"] = True
self.args["supportsAllDrives"] = True
self.args["fileId"] = file_id
self.name = name
self.reader = reader
Expand Down Expand Up @@ -397,7 +396,7 @@ class _ListFilesRequest(_Lister[_GoogleFileDescriptor]):
def __init__(self, service: Any, url_base: Optional[str] = None, **kwargs):
super().__init__(service, **kwargs)
# Get team drives too
self.args["supportsTeamDrives"] = True
self.args["supportsAllDrives"] = True
self.args["includeTeamDriveItems"] = True
self.args["fields"] = "files(id, name, mimeType, parents)"
self.url_base = url_base
Expand Down

0 comments on commit 6d5e19e

Please sign in to comment.