import requests
requests.get('http://gett.bike/')
This code raises the following exception:
ContentDecodingError: ('Received response with content-encoding: gzip, but failed to decode it.',
error('Error -3 while decompressing data: incorrect data check',))
Arch linux x64
requests==2.13.0
python=3.6.0
This seems like the server is returning data it claims is gzipped, but isn't, or is invalid somehow. curl agrees with this assessment, as you can see by doing curl -L --compressed http://gett.bike, which leads to:
curl: (23) Error while processing content unencoding: invalid block type
You can work around this for now by setting the Accept-Encoding header to identity:
import requests
requests.get('http://gett.bike/', headers={'Accept-Encoding': 'identity'})
But I strongly recommend you reach out to the server operator and get them to fix their server.
I'm now receiving that same error. I've even switched hosting providers. Here's my output. Any ideas?
```Environment:
Request Method: GET
Request URL: https://sm8attachments.com/authenticate/callback/?code=1ace2d4df855a2b7e5fb6b1add0581102127cd5b&state=
Django Version: 2.1
Python Version: 3.6.6
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django_celery_results',
'django.contrib.sites',
'user',
'account',
'attachment',
'webhook',
'authenticate',
'subscribe',
'home']
Installed Middleware:
('whitenoise.middleware.WhiteNoiseMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware')
Traceback:
File "/app/.heroku/python/lib/python3.6/site-packages/urllib3/response.py" in _decode
File "/app/.heroku/python/lib/python3.6/site-packages/urllib3/response.py" in decompress
During handling of the above exception (Error -3 while decompressing data: incorrect data check), another exception occurred:
File "/app/.heroku/python/lib/python3.6/site-packages/requests/models.py" in generate
File "/app/.heroku/python/lib/python3.6/site-packages/urllib3/response.py" in stream
File "/app/.heroku/python/lib/python3.6/site-packages/urllib3/response.py" in read
File "/app/.heroku/python/lib/python3.6/site-packages/urllib3/response.py" in _decode
During handling of the above exception (('Received response with content-encoding: gzip, but failed to decode it.', error('Error -3 while decompressing data: incorrect data check',))), another exception occurred:
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
File "/app/.heroku/python/lib/python3.6/site-packages/django/views/generic/base.py" in view
File "/app/.heroku/python/lib/python3.6/site-packages/django/views/generic/base.py" in dispatch
File "/app/authenticate/views.py" in get
File "/app/authenticate/views.py" in get_vendors
File "/app/.heroku/python/lib/python3.6/site-packages/requests/api.py" in get
File "/app/.heroku/python/lib/python3.6/site-packages/requests/api.py" in request
File "/app/.heroku/python/lib/python3.6/site-packages/requests/sessions.py" in request
File "/app/.heroku/python/lib/python3.6/site-packages/requests/sessions.py" in send
File "/app/.heroku/python/lib/python3.6/site-packages/requests/models.py" in content
File "/app/.heroku/python/lib/python3.6/site-packages/requests/models.py" in generate
Exception Type: ContentDecodingError at /authenticate/callback/
Exception Value: ('Received response with content-encoding: gzip, but failed to decode it.', error('Error -3 while decompressing data: incorrect data check',))```
Most helpful comment
This seems like the server is returning data it claims is gzipped, but isn't, or is invalid somehow. curl agrees with this assessment, as you can see by doing
curl -L --compressed http://gett.bike, which leads to:curl: (23) Error while processing content unencoding: invalid block typeYou can work around this for now by setting the
Accept-Encodingheader toidentity:But I strongly recommend you reach out to the server operator and get them to fix their server.