Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating specific entity on application start #125

Open
jancoow opened this issue Nov 2, 2019 · 0 comments
Open

Updating specific entity on application start #125

jancoow opened this issue Nov 2, 2019 · 0 comments

Comments

@jancoow
Copy link

jancoow commented Nov 2, 2019

Hi,

I want to update a specific entity when my flask application starts. This list is received from my database. However, I'm unable to use the api object inside the assistent:

self.assist.api.put_entity(entity_json=entities, entity_id='xx')

Results in this error:

  File "/usr/lib/python3.7/site-packages/api_ai/api.py", line 122, in put_entity
    endpoint = self._entity_uri(entity_id)
  File "/usr/lib/python3.7/site-packages/api_ai/api.py", line 52, in _entity_uri
    return "{}entities{}?v={}".format(self.base_url, entity_id, self.versioning)


But event after setting this version manually it is crashing because it is receiving a non-json message from the google api.

self.assist.api.versioning = ''

File "/usr/lib/python3.7/site-packages/api_ai/api.py", line 123, in put_entity return self._put(endpoint, data=entity_json) File "/usr/lib/python3.7/site-packages/api_ai/api.py", line 72, in _put return response.json() File "/usr/lib/python3.7/site-packages/requests/models.py", line 897, in json return complexjson.loads(self.text, **kwargs) File "/usr/lib/python3.7/site-packages/simplejson/__init__.py", line 538, in loads return _default_decoder.decode(s) File "/usr/lib/python3.7/site-packages/simplejson/decoder.py", line 370, in decode obj, end = self.raw_decode(s) File "/usr/lib/python3.7/site-packages/simplejson/decoder.py", line 400, in raw_decode return self.scan_once(s, idx=_w(s, idx).end()) simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

So how can I use the api to add a list of values to a specific entity?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant