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 authored and dlstadther committed Mar 14, 2018
1 parent 9735b5a commit b583a5b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions luigi/contrib/gcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,18 @@ 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', cache_discovery=False, **authenticate_kwargs)
build_kwargs.setdefault('cache_discovery', False)
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 b583a5b

Please sign in to comment.