'Http' object has no attribute 'close'
See original GitHub issueEnvironment details
-
OS type and version: ubuntu 16.04.6 LTS (4.15.0-1050-gcp)
-
Python version: 3.6.8
-
pip version: 3.6
-
google-api-python-client
version: 1.7.1 -
Other dependency
from apiclient.discovery import build
SCOPES = ['https://www.googleapis.com/auth/analytics.readonly']
KEY_FILE_LOCATION = conf.KEY_FILE_LOCATION
credentials = ServiceAccountCredentials.from_json_keyfile_name(
KEY_FILE_LOCATION, SCOPES)
# Build the service object.
if version == 'v4':
analytics = build('analyticsreporting', 'v4', credentials=credentials, cache_discovery=False)
elif version == 'v3':
analytics = build('analytics', 'v3', credentials=credentials, cache_discovery=False)
return analytics
PS. KEY_FILE_LOCATION
is a json key generated from GCP
Stack trace
File "/home/dsu/ddt_dashboard/ddt_get_ga_report/lib/app.py", line 454, in get_report
analyticsV3 = initialize_analyticsreporting('v3')
File "/home/dsu/ddt_dashboard/ddt_get_ga_report/lib/app.py", line 117, in initialize_analyticsreporting
analytics = build('analytics', 'v3', credentials=credentials, cache_discovery=False)
File "/usr/local/lib/python3.6/dist-packages/googleapiclient/_helpers.py", line 134, in positional_wrapper
return wrapped(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/googleapiclient/discovery.py", line 300, in build
discovery_http.close()
AttributeError: 'Http' object has no attribute 'close'
The code works fine on my local machine (win10). Not sure if it is about package dependency or something else.
Any suggestions would be appreciated, thanks.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:13
Top Results From Across the Web
Python AttributeError: NoneType object has no attribute 'close'
I am learning python and I wrote a script that copies the content of one text file to another. Here is my code....
Read more >AttributeError: 'BlobMedia' object has no attribute 'status'
I am making an HTTP request from client code and I want to ensure the status of the response is a successful one....
Read more >B2G "AttributeError: 'NoneType' object has no attribute 'close ...
Broken out from bug 1009316. example: https://tbpl.mozilla.org/php/getParsedLog.php?id=39918406&tree=Try { 17:53:40 INFO - TEST-START ...
Read more >http.client — HTTP protocol client — Python 3.11.1 ...
Source code: Lib/http/client.py This module defines classes that implement the client side of ... indicating that the remote end has closed the connection....
Read more >Request and response objects - Django documentation
The path_info attribute always contains the path info portion of the path, no matter ... A dictionary-like object containing all given HTTP POST...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@frankShih
Having a look at
httplib2
changelog,close()
method appeared in v0.15.0According your error report, you have version 0.12.0.
Please, upgrade 1st, then retry and report. Thanks
Fixed for me aswell.
google-api-python-client: 1.12.2 httplib2: 0.18.1