Skip to content

Commit

Permalink
Pass kwargs to discovery.build() when instantiating GSCClient.
Browse files Browse the repository at this point in the history
  • Loading branch information
danthelion committed Nov 22, 2017
1 parent 8ae5b65 commit 97c140e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions luigi/contrib/gcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,17 @@ class GCSClient(luigi.target.FileSystem):
as the ``descriptor`` argument.
"""
def __init__(self, oauth_credentials=None, descriptor='', http_=None,
chunksize=CHUNKSIZE):
chunksize=CHUNKSIZE, **discovery_build_kwargs):
self.chunksize = chunksize
authenticate_kwargs = gcp.get_authenticate_kwargs(oauth_credentials, http_)

build_kwargs = authenticate_kwargs.copy()
build_kwargs.update(discovery_build_kwargs)

if descriptor:
self.client = discovery.build_from_document(descriptor, **authenticate_kwargs)
self.client = discovery.build_from_document(descriptor, **build_kwargs)
else:
self.client = discovery.build('storage', 'v1', **authenticate_kwargs)
self.client = discovery.build('storage', 'v1', **build_kwargs)

def _path_to_bucket_and_key(self, path):
(scheme, netloc, path, _, _) = urlsplit(path)
Expand Down

0 comments on commit 97c140e

Please sign in to comment.