.activity_pub.processing
If you use cattle_grid as a middleware, it takes care of communicating to the Fediverse for you. This means instead of having to handle receiving and sending HTTP post requests, you will be dealing with RabbitMQ routing. The relevant routing keys will be
where the message content is given by the ActivityMessage type.
cattle_grid.model
ActivityMessage
Bases: BaseModel
Message that contains an Activity. Activity is used as the name for the ‘data object’ being exchanged, as is common in the Fediverse
Source code in cattle_grid/model/__init__.py
activity_type: str
instance-attribute
Type of the Activity
actor: str
instance-attribute
actor_id of the actor that received the message
data: Dict[str, Any]
instance-attribute
Activity.
FetchMessage
Bases: BaseModel
Used to request an ActivityPub object to be retrieved
Source code in cattle_grid/model/__init__.py
actor: str
instance-attribute
actor_id of the actor that received the message
uri: str
instance-attribute
URI of the object being retrieved
JSON Schema
This section provides the json-schema documents used on this page.
ActivityMessage
{
"$schema": "http://json-schema.org/draft-06/schema#",
"definitions": {
"ActivityMessage": {
"type": "object",
"additionalProperties": false,
"title": "Activity Message",
"description": "Message that contains an Activity. Activity is used as the name for the 'data object' being exchanged, as is common in the Fediverse",
"properties": {
"actor": {
"type": "string",
"description": "actor_id of the actor that received the message"
},
"data": {
"type": "object",
"description": "Activity."
},
"activity_type": {
"type": "string",
"description": "Type of the Activity"
}
},
"required": ["data", "actor", "activity_type"]
},
"FetchMessage": {
"type": "object",
"additionalProperties": false,
"title": "Fetch Message",
"description": "Used to request an ActivityPub object to be retrieved",
"properties": {
"actor": {
"type": "string",
"description": "actor_id of the actor that received the message"
},
"uri": {
"type": "string",
"description": "URI of the object being retrieved"
}
},
"required": ["uri", "actor"]
}
}
}
cattle_grid.activity_pub.processing
cattle_grid.activity_pub.processing.incoming
incoming_accept_activity(msg, actor=Depends(actor_for_message), broker=Context())
async
Handles an incoming Accept activity
Source code in cattle_grid/activity_pub/processing/incoming.py
incoming_block_activity(msg, actor=Depends(actor_for_message), broker=Context())
async
Handles an incoming Block activity
Source code in cattle_grid/activity_pub/processing/incoming.py
incoming_follow_request(msg, actor=Depends(actor_for_message), broker=Context())
async
Handles an incoming follow request
Source code in cattle_grid/activity_pub/processing/incoming.py
incoming_reject_activity(msg, actor=Depends(actor_for_message), broker=Context())
async
Handles an incoming Reject activity
Source code in cattle_grid/activity_pub/processing/incoming.py
incoming_undo_activity(msg, actor=Depends(actor_for_message), broker=Context())
async
Handles an incoming Undo activity
Source code in cattle_grid/activity_pub/processing/incoming.py
cattle_grid.activity_pub.processing.outgoing
outgoing_accept_request(msg, actor=Depends(actor_for_message), broker=Context())
async
Handles an outgoing Accept activity
Source code in cattle_grid/activity_pub/processing/outgoing.py
outgoing_block_activity(msg, actor=Depends(actor_for_message), broker=Context())
async
Handles an outgoing Block activity
Source code in cattle_grid/activity_pub/processing/outgoing.py
outgoing_follow_request(msg, actor=Depends(actor_for_message), broker=Context())
async
Handles an outgoing Follow request
Source code in cattle_grid/activity_pub/processing/outgoing.py
outgoing_message_distribution(msg, broker=Context())
async
Distributes the message to its recipients
Source code in cattle_grid/activity_pub/processing/outgoing.py
outgoing_reject_activity(msg, actor=Depends(actor_for_message), broker=Context())
async
Handles an outgoing Reject activity
Source code in cattle_grid/activity_pub/processing/outgoing.py
outgoing_undo_request(msg, actor=Depends(actor_for_message), broker=Context())
async
Handles an outgoing Undo activity
Source code in cattle_grid/activity_pub/processing/outgoing.py
cattle_grid.activity_pub.processing.remote
fetch_object(msg, actor=Depends(bovine_actor_for_message), session=Context())
async
Handles retrieving a remote object
Source code in cattle_grid/activity_pub/processing/remote.py
resolve_inbox(actor, target)
async
Resolves the inbox of target for actor using a cache
Source code in cattle_grid/activity_pub/processing/remote.py
sending_message(msg, actor=Depends(bovine_actor_for_message), session=Context())
async
Handles sending a message