Apps

Apps

API

Apps

class heedy.apps.Apps(constraints, session)[source]

Bases: heedy.base.APIList

App

class heedy.App(access_token, url='http://localhost:1324', session='sync', cached_data={})[source]

Bases: heedy.base.APIObject

delete(**kwargs)

Calls the element’s URI with the DELETE method. This is a method available for all subclasses of APIObject (objects, apps, users, etc), and removes all associated data from Heedy.

o.delete()
o.read() # Throws error - it longer exists!
await o.delete()
await o.read() # Throws error - it no longer exists!
Parameters

**kwargs – Arguments to pass as query parameters to the server (usually empty)

Raises

HeedyException – If the server returns an error, or when the app does not have permission to delete.

notifications

A Notifications object that allows you to access the notifications associated with this element. See Notifications for details.

notify(*args, **kwargs)

Shorthand for self.notifications.notify (see Notifications).

property owner

Returns the user that owns the app

read(**kwargs)

Sends a GET request to the element’s URI with function arguments as query parameters. This method is available for all subclasses of APIObject (objects, apps, users, etc), and is used to read element’s properties in heedy.

data = o.read(icon=True)
data = await o.read(icon=True)

Caches the result of the read as attributes of the object:

assert data["name"] == o["name"]

The read or update functions both update the cached data automatically.

Parameters

**kwargs – The url parameters to send with the request.

Returns

The server’s response dict, namely a dict of the element’s properties.

Raises

HeedyException – If the server returns an error.

update(**kwargs)

Sends a PATCH request to element’s URI with arguments as a json object. This method is available for all subclasses of APIObject (objects, apps, users, etc), and is used to update the element’s properties in heedy.

o.update(name="My new name",description="my new description")
assert o["name"] == "My new name"
await o.update(name="My new name",description="my new description")
assert o["name"] == "My new name"
Parameters

**kwargs – The properties to update, sent as the json body of the request.

Returns

The server’s response as a dict, namely the updated element’s properties.

Raises

HeedyException – If the server returns an error, such as when there are insufficient permissions.