-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
api: storageIssues related to the Cloud Storage API.Issues related to the Cloud Storage API.
Description
Hi,
I'm having trouble while using google.cloud for Storage. I start by trying to list blobs in a bucket.
I'm trying to get threw the proxy of my organization. So I try to create my own http connection in order to specify the proxy, but even with a simple urllib3.PoolManager(), I keep getting the error and stacktrace bellow:
Error:
TypeError: request() takes at least 3 arguments (3 given)
Stacktrace:
Traceback (most recent call last)
<ipython-input-9-a7bd2d0fcc13> in <module>()
3 authed_http = AuthorizedHttp(credentials, http)
4 storage_client = storage.Client(_http=http)
----> 5 bucket = storage_client.get_bucket('mybucket')
6 blobs = bucket.list_blobs()
7
/gpfs/user/u515866/env_python2/lib/python2.7/site-packages/google/cloud/storage/client.pyc in get_bucket(self, bucket_name)
171 """
172 bucket = Bucket(self, name=bucket_name)
--> 173 bucket.reload(client=self)
174 return bucket
175
/gpfs/user/u515866/env_python2/lib/python2.7/site-packages/google/cloud/storage/_helpers.pyc in reload(self, client)
97 api_response = client._connection.api_request(
98 method='GET', path=self.path, query_params=query_params,
---> 99 _target_object=self)
100 self._set_properties(api_response)
101
/gpfs/user/u515866/env_python2/lib/python2.7/site-packages/google/cloud/_http.pyc in api_request(self, method, path, query_params, data, content_type, headers, api_base_url, api_version, expect_json, _target_object)
297 response, content = self._make_request(
298 method=method, url=url, data=data, content_type=content_type,
--> 299 headers=headers, target_object=_target_object)
300
301 if not 200 <= response.status < 300:
/gpfs/user/u515866/env_python2/lib/python2.7/site-packages/google/cloud/_http.pyc in _make_request(self, method, url, data, content_type, headers, target_object)
191 headers['User-Agent'] = self.USER_AGENT
192
--> 193 return self._do_request(method, url, headers, data, target_object)
194
195 def _do_request(self, method, url, headers, data,
/gpfs/user/u515866/env_python2/lib/python2.7/site-packages/google/cloud/_http.pyc in _do_request(self, method, url, headers, data, target_object)
221 """
222 return self.http.request(uri=url, method=method, headers=headers,
--> 223 body=data)
224
225 def api_request(self, method, path, query_params=None,
TypeError: request() takes at least 3 arguments (3 given)
My code is the following:
from google.oauth2 import service_account
from google.cloud import storage
import urllib3
from google.auth.transport.urllib3 import AuthorizedHttp
json="pathtojson"
credentials = service_account.Credentials.from_service_account_file(json)
http = urllib3.PoolManager()
#authed_http = AuthorizedHttp(credentials, http)
storage_client = storage.Client(_http=http)
bucket = storage_client.get_bucket('mybucket')
blobs = bucket.list_blobs()
for blob in blobs:
print(blob.name)Python is 2.7.11.
I'm using Jupyter (notebook server is 5.0.0).
pip freeze:
Click to expand
asn1crypto==0.22.0 backports-abc==0.5 backports.shutil-get-terminal-size==1.0.0 bleach==2.0.0 cachetools==2.0.0 certifi==2017.4.17 cffi==1.10.0 chardet==3.0.4 configparser==3.5.0 cx-Oracle==5.3 decorator==4.0.11 dill==0.2.7.1 entrypoints==0.2.3 enum34==1.1.6 functools32==3.2.3.post2 future==0.16.0 futures==3.1.1 gapic-google-cloud-datastore-v1==0.15.3 gapic-google-cloud-error-reporting-v1beta1==0.15.3 gapic-google-cloud-logging-v2==0.91.3 gapic-google-cloud-pubsub-v1==0.15.4 gapic-google-cloud-spanner-admin-database-v1==0.15.3 gapic-google-cloud-spanner-admin-instance-v1==0.15.3 gapic-google-cloud-spanner-v1==0.15.3 gapic-google-cloud-speech-v1==0.15.3 gapic-google-logging-v2==0.10.1 gapic-google-pubsub-v1==0.10.1 google-api-python-client==1.6.2 google-auth==1.0.1 google-auth-httplib2==0.0.2 google-cloud==0.26.1 google-cloud-bigquery==0.25.0 google-cloud-bigtable==0.25.0 google-cloud-core==0.25.0 google-cloud-datastore==1.1.0 google-cloud-dns==0.25.0 google-cloud-error-reporting==0.25.1 google-cloud-happybase==0.21.0 google-cloud-language==0.25.0 google-cloud-logging==1.1.0 google-cloud-monitoring==0.25.0 google-cloud-pubsub==0.26.0 google-cloud-resource-manager==0.25.0 google-cloud-runtimeconfig==0.25.0 google-cloud-spanner==0.25.0 google-cloud-speech==0.26.0 google-cloud-storage==1.2.0 google-cloud-translate==0.25.0 google-cloud-videointelligence==0.25.0 google-cloud-vision==0.25.0 google-gax==0.15.13 google-resumable-media==0.2.1 googleapis-common-protos==1.5.2 grpc-google-iam-v1==0.11.1 grpc-google-logging-v2==0.10.1 grpc-google-pubsub-v1==0.10.1 grpcio==1.4.0 html5lib==0.999999999 httplib2==0.10.3 idna==2.5 ipaddress==1.0.18 ipykernel==4.6.1 ipython==5.4.1 ipython-genutils==0.2.0 ipywidgets==6.0.0 Jinja2==2.9.6 jsonschema==2.6.0 jupyter==1.0.0 jupyter-client==5.1.0 jupyter-console==5.1.0 jupyter-core==4.3.0 MarkupSafe==1.0 mistune==0.7.4 nbconvert==5.2.1 nbformat==4.3.0 notebook==5.0.0 numpy==1.13.1 oauth2client==3.0.0 oauthclient==1.0.3 pandas==0.20.3 pandocfilters==1.4.1 pathlib2==2.3.0 pexpect==4.2.1 pickleshare==0.7.4 ply==3.8 prompt-toolkit==1.0.14 proto-google-cloud-datastore-v1==0.90.4 proto-google-cloud-error-reporting-v1beta1==0.15.3 proto-google-cloud-logging-v2==0.91.3 proto-google-cloud-pubsub-v1==0.15.4 proto-google-cloud-spanner-admin-database-v1==0.15.3 proto-google-cloud-spanner-admin-instance-v1==0.15.3 proto-google-cloud-spanner-v1==0.15.3 proto-google-cloud-speech-v1==0.15.3 protobuf==3.3.0 ptyprocess==0.5.2 pyasn1==0.2.3 pyasn1-modules==0.0.9 pycparser==2.18 Pygments==2.2.0 pysqlite==2.8.3 python-dateutil==2.6.1 pytz==2017.2 pyzmq==16.0.2 qtconsole==4.3.0 requests==2.18.1 rsa==3.4.2 scandir==1.5 simplegeneric==0.8.1 singledispatch==3.4.0.3 six==1.10.0 SQLAlchemy==1.1.11 terminado==0.6 testpath==0.3.1 tornado==4.5.1 traitlets==4.3.2 uritemplate==3.0.0 urllib3==1.21.1 wcwidth==0.1.7 webencodings==0.5.1 widgetsnbextension==2.0.0
Please feel free to reformat this issue if that could help.
Many thanks.
Metadata
Metadata
Assignees
Labels
api: storageIssues related to the Cloud Storage API.Issues related to the Cloud Storage API.