This is the baseclass for all pykechain models.

class Base(json: Dict, client: Client)[source]

Base model connecting retrieved data to a KE-chain client.

  • id – The UUID of the object (corresponds with the UUID in KE-chain).

  • name – The name of the object.

  • created_at – the datetime when the object was created if available (otherwise None)

  • updated_at – the datetime when the object was last updated if available (otherwise None)

Construct a model from provided json data.

refresh(json: Optional[Dict] = None, url: Optional[str] = None, extra_params: Optional[Dict] = None)[source]

Refresh the object in place.

Can be called on the object without any arguments and should refresh the object inplace. If you want to use it in an advance way, you may call it with a json response from the server or provide the url to refetch the object from the server if the url cant be determined from the object itself.

It is using the Client.reload() function to re-retrieve the object in a backend API call.

  • json (None or dict) – (optional) json dictionary from a response from the server, will re-init object

  • url (None or basestring) – (optional) url to retrieve the object again, typically an identity url api/<service>/id

  • extra_params (None or dict) – (optional) additional paramenters (query params) for the request eg dict(fields=’__all__’)