Closed meltedhead closed 3 years ago
I have deployed doccano locally and still seeing this issue.
doccano_client = DoccanoClient(
"http://0.0.0.0:8080/",
"admin", "TestPassword")
---------------------------------------------------------------------------
JSONDecodeError Traceback (most recent call last)
<ipython-input-185-0b0ad54afd78> in <module>
1 doccano_client = DoccanoClient(
2 "http://0.0.0.0:8080/",
----> 3 "admin", "TestPassword")
~/.pyenv/versions/3.6.10/lib/python3.6/site-packages/doccano_api_client/__init__.py in __init__(self, baseurl, username, password)
107 self.baseurl = baseurl if baseurl[-1] == '/' else baseurl+'/'
108 self.session = requests.Session()
--> 109 self._login(username, password)
110
111 def _login(
~/.pyenv/versions/3.6.10/lib/python3.6/site-packages/doccano_api_client/__init__.py in _login(self, username, password)
125 url = 'v1/auth-token'
126 auth = {'username': username, 'password': password}
--> 127 response = self.post(url, auth)
128 token = response['token']
129 self.session.headers.update(
~/.pyenv/versions/3.6.10/lib/python3.6/site-packages/doccano_api_client/__init__.py in post(self, endpoint, data, json, files)
62 request_url = urljoin(self.baseurl, endpoint)
63 return self.session.post(
---> 64 request_url, data=data, files=files, json=json).json()
65
66 def delete(
~/.pyenv/versions/3.6.10/lib/python3.6/site-packages/requests/models.py in json(self, **kwargs)
896 # used.
897 pass
--> 898 return complexjson.loads(self.text, **kwargs)
899
900 @property
~/.pyenv/versions/3.6.10/lib/python3.6/site-packages/simplejson/__init__.py in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, use_decimal, **kw)
523 parse_constant is None and object_pairs_hook is None
524 and not use_decimal and not kw):
--> 525 return _default_decoder.decode(s)
526 if cls is None:
527 cls = JSONDecoder
~/.pyenv/versions/3.6.10/lib/python3.6/site-packages/simplejson/decoder.py in decode(self, s, _w, _PY3)
368 if _PY3 and isinstance(s, bytes):
369 s = str(s, self.encoding)
--> 370 obj, end = self.raw_decode(s)
371 end = _w(s, end).end()
372 if end != len(s):
~/.pyenv/versions/3.6.10/lib/python3.6/site-packages/simplejson/decoder.py in raw_decode(self, s, idx, _w, _PY3)
398 elif ord0 == 0xef and s[idx:idx + 3] == '\xef\xbb\xbf':
399 idx += 3
--> 400 return self.scan_once(s, idx=_w(s, idx).end())
JSONDecodeError: Expecting value: line 2 column 1 (char 1)
It has to do with crf protection on the doccano backend. This should be disabled for /v1/api calls in my opinion.
Fixed.
I have deployed doccano to aws and now trying to use the client to upload data from an airflow pipeline but I can't seem to connect with the client. I am following the instructions but i keep getting an error:
I then get the error below