Skip to content

Unexpected token B in JSON at position 0 #1

@vroger11

Description

@vroger11

I just wanted to try your API. After installing everything like in the README, I get an Unexpected token error on the example given in the README. Any help will be great, thanks.

All informations (also, I used the version tagged "v1.0"):

Request Method: GET
http://127.0.0.1:8000/v1/vegetation-health/?from=2021-03-01&to=2021-03-30&location=Berlin
3.1.13
SatSearchError
Unexpected token B in JSON at position 0
/home/vroger/.miniconda3/envs/open_data/lib/python3.9/site-packages/satsearch/search.py, line 80, in query
/home/vroger/.miniconda3/envs/open_data/bin/python
3.9.6
['/home/vroger/git/api.openspacedata.org', '/home/vroger/.miniconda3/envs/open_data/lib/python39.zip', '/home/vroger/.miniconda3/envs/open_data/lib/python3.9', '/home/vroger/.miniconda3/envs/open_data/lib/python3.9/lib-dynload', '/home/vroger/.miniconda3/envs/open_data/lib/python3.9/site-packages']
Tue, 03 Aug 2021 17:03:48 +0000

Environment:

Request Method: GET
Request URL: http://127.0.0.1:8000/v1/vegetation-health/?from=2021-03-01&to=2021-03-30&location=Berlin

Django Version: 3.1.13
Python Version: 3.9.6
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'rest_framework.authtoken',
'api']
Installed Middleware:
['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']

Traceback (most recent call last):
File "/home/vroger/.miniconda3/envs/open_data/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/home/vroger/.miniconda3/envs/open_data/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/vroger/.miniconda3/envs/open_data/lib/python3.9/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
File "/home/vroger/.miniconda3/envs/open_data/lib/python3.9/site-packages/django/views/generic/base.py", line 70, in view
return self.dispatch(request, *args, **kwargs)
File "/home/vroger/.miniconda3/envs/open_data/lib/python3.9/site-packages/rest_framework/views.py", line 509, in dispatch
response = self.handle_exception(exc)
File "/home/vroger/.miniconda3/envs/open_data/lib/python3.9/site-packages/rest_framework/views.py", line 469, in handle_exception
self.raise_uncaught_exception(exc)
File "/home/vroger/.miniconda3/envs/open_data/lib/python3.9/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
raise exc
File "/home/vroger/.miniconda3/envs/open_data/lib/python3.9/site-packages/rest_framework/views.py", line 506, in dispatch
response = handler(request, *args, **kwargs)
File "/home/vroger/git/api.openspacedata.org/api/views.py", line 28, in get
return Response(downloads.data)
File "/home/vroger/.miniconda3/envs/open_data/lib/python3.9/site-packages/rest_framework/serializers.py", line 548, in data
ret = super().data
File "/home/vroger/.miniconda3/envs/open_data/lib/python3.9/site-packages/rest_framework/serializers.py", line 246, in data
self._data = self.to_representation(self.instance)
File "/home/vroger/.miniconda3/envs/open_data/lib/python3.9/site-packages/rest_framework/serializers.py", line 515, in to_representation
ret[field.field_name] = field.to_representation(attribute)
File "/home/vroger/.miniconda3/envs/open_data/lib/python3.9/site-packages/rest_framework/fields.py", line 1882, in to_representation
return method(value)
File "/home/vroger/git/api.openspacedata.org/api/serializers.py", line 65, in get_files
items = bbox_search.items()
File "/home/vroger/.miniconda3/envs/open_data/lib/python3.9/site-packages/satsearch/search.py", line 90, in items
found = self.found(headers=headers)
File "/home/vroger/.miniconda3/envs/open_data/lib/python3.9/site-packages/satsearch/search.py", line 62, in found
results = self.query(url=url, headers=headers, **kwargs)
File "/home/vroger/.miniconda3/envs/open_data/lib/python3.9/site-packages/satsearch/search.py", line 80, in query
raise SatSearchError(response.text)

Exception Type: SatSearchError at /v1/vegetation-health/
Exception Value: Unexpected token B in JSON at position 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions