Abacn commented on code in PR #25965:
URL: https://github.com/apache/beam/pull/25965#discussion_r1213269143
##########
sdks/python/apache_beam/io/gcp/gcsio.py:
##########
@@ -162,20 +124,16 @@ class GcsIOError(IOError, retry.PermanentException):
class GcsIO(object):
"""Google Cloud Storage I/O client."""
def __init__(self, storage_client=None, pipeline_options=None):
- # type: (Optional[storage.StorageV1], Optional[Union[dict,
PipelineOptions]]) -> None
+ # type: (Optional[storage.Client], Optional[Union[dict, PipelineOptions]])
-> None
if storage_client is None:
if not pipeline_options:
pipeline_options = PipelineOptions()
elif isinstance(pipeline_options, dict):
pipeline_options = PipelineOptions.from_dictionary(pipeline_options)
- storage_client = storage.StorageV1(
- credentials=auth.get_service_credentials(pipeline_options),
- get_credentials=False,
- http=get_new_http(),
- response_encoding='utf8',
- additional_http_headers={
- "User-Agent": "apache-beam-%s" % apache_beam.__version__
- })
+ credentials = auth.get_service_credentials(pipeline_options)
+ if credentials:
+ credentials = credentials.get_google_auth_credentials()
Review Comment:
oops this was a typo, I meant
```
if credentials is not None:
storage_client =
storage.Client(credentials=credentials.get_google_auth_credentials())
else:
storage_client = storage.Client.create_anonymous_client()
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]