bovine.activitystreams.utils
bovine.activitystreams.utils
uris_for_public
module-attribute
URIs used to represent the public collection. See Section 5.6 of ActivityPub.
actor_for_object
Look up for the actor id either from attributedTo or actor
Source code in bovine/bovine/activitystreams/utils/__init__.py
as_list
contains_public
Checks if the list contains public
Source code in bovine/bovine/activitystreams/utils/__init__.py
copy_to_and_cc
Copies the audience from the origin object to the destination object
Source code in bovine/bovine/activitystreams/utils/__init__.py
fediverse_handle_from_actor
Given an actor object, i.e. a dict, determines the fediverse handle
Source code in bovine/bovine/activitystreams/utils/__init__.py
id_for_object
Determines the id of an object
>>> id_for_object("http://obj.example")
'http://obj.example'
>>> id_for_object({"id": "http://obj.example"})
'http://obj.example'
>>> id_for_object({"name": "alice"}) is None
True
Source code in bovine/bovine/activitystreams/utils/__init__.py
is_public
Determines if the object should be considered public based on its recipients
property_for_key_as_set
Returns value as a set, useful for to
and cc
Source code in bovine/bovine/activitystreams/utils/__init__.py
recipients_for_object
Combines the recipients from to, cc, bto, bcc, audience into a set
>>> result = recipients_for_object({
... "to": ["http://to.example"],
... "cc": "http://cc.example",
... "bcc": ["http://bcc.example"],
... "audience": "http://audience.example"})
>>> sorted(result)
['http://audience.example', 'http://bcc.example',
'http://cc.example', 'http://to.example']
Note
treatment of audience might change.