Skip to content
This repository was archived by the owner on Jun 26, 2025. It is now read-only.
This repository was archived by the owner on Jun 26, 2025. It is now read-only.

Updating specific entity on application start #125

@jancoow

Description

@jancoow

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions