chitose.tools.ozone.moderation package#

Submodules#

chitose.tools.ozone.moderation.defs module#

class chitose.tools.ozone.moderation.defs.BlobView(cid: str, mime_type: str, size: int, created_at: str, details: ImageDetails | VideoDetails | None = None, moderation: Moderation | None = None)#

Bases: Object

to_dict() dict[str, Any]#
class chitose.tools.ozone.moderation.defs.ImageDetails(width: int, height: int)#

Bases: Object

to_dict() dict[str, Any]#
class chitose.tools.ozone.moderation.defs.ModEventAcknowledge(comment: str | None = None)#

Bases: Object

to_dict() dict[str, Any]#
class chitose.tools.ozone.moderation.defs.ModEventComment(comment: str, sticky: bool | None = None)#

Bases: Object

Add a comment to a subject

Parameters:

sticky – Make the comment persistent on the subject

to_dict() dict[str, Any]#
class chitose.tools.ozone.moderation.defs.ModEventDivert(comment: str | None = None)#

Bases: Object

Divert a record’s blobs to a 3rd party service for further scanning/tagging

to_dict() dict[str, Any]#
class chitose.tools.ozone.moderation.defs.ModEventEmail(subject_line: str, content: str | None = None, comment: str | None = None)#

Bases: Object

Keep a log of outgoing email to a user

Parameters:
  • subject_line – The subject line of the email sent to the user.

  • content – The content of the email sent to the user.

  • comment – Additional comment about the outgoing comm.

to_dict() dict[str, Any]#
class chitose.tools.ozone.moderation.defs.ModEventEscalate(comment: str | None = None)#

Bases: Object

to_dict() dict[str, Any]#
class chitose.tools.ozone.moderation.defs.ModEventLabel(create_label_vals: list[str], negate_label_vals: list[str], comment: str | None = None)#

Bases: Object

Apply/Negate labels on a subject

to_dict() dict[str, Any]#
class chitose.tools.ozone.moderation.defs.ModEventMute(duration_in_hours: int, comment: str | None = None)#

Bases: Object

Mute incoming reports on a subject

Parameters:

duration_in_hours – Indicates how long the subject should remain muted.

to_dict() dict[str, Any]#
class chitose.tools.ozone.moderation.defs.ModEventMuteReporter(duration_in_hours: int, comment: str | None = None)#

Bases: Object

Mute incoming reports from an account

Parameters:

duration_in_hours – Indicates how long the account should remain muted.

to_dict() dict[str, Any]#
class chitose.tools.ozone.moderation.defs.ModEventReport(report_type: Literal['com.atproto.moderation.defs#reasonSpam', 'com.atproto.moderation.defs#reasonViolation', 'com.atproto.moderation.defs#reasonMisleading', 'com.atproto.moderation.defs#reasonSexual', 'com.atproto.moderation.defs#reasonRude', 'com.atproto.moderation.defs#reasonOther', 'com.atproto.moderation.defs#reasonAppeal'], comment: str | None = None, is_reporter_muted: bool | None = None)#

Bases: Object

Report a subject

Parameters:

is_reporter_muted – Set to true if the reporter was muted from reporting at the time of the event. These reports won’t impact the reviewState of the subject.

to_dict() dict[str, Any]#
class chitose.tools.ozone.moderation.defs.ModEventResolveAppeal(comment: str | None = None)#

Bases: Object

Resolve appeal on a subject

Parameters:

comment – Describe resolution.

to_dict() dict[str, Any]#
class chitose.tools.ozone.moderation.defs.ModEventReverseTakedown(comment: str | None = None)#

Bases: Object

Revert take down action on a subject

Parameters:

comment – Describe reasoning behind the reversal.

to_dict() dict[str, Any]#
class chitose.tools.ozone.moderation.defs.ModEventTag(add: list[str], remove: list[str], comment: str | None = None)#

Bases: Object

Add/Remove a tag on a subject

Parameters:
  • add – Tags to be added to the subject. If already exists, won’t be duplicated.

  • remove – Tags to be removed to the subject. Ignores a tag If it doesn’t exist, won’t be duplicated.

  • comment – Additional comment about added/removed tags.

to_dict() dict[str, Any]#
class chitose.tools.ozone.moderation.defs.ModEventTakedown(comment: str | None = None, duration_in_hours: int | None = None, acknowledge_account_subjects: bool | None = None)#

Bases: Object

Take down a subject permanently or temporarily

Parameters:
  • duration_in_hours – Indicates how long the takedown should be in effect before automatically expiring.

  • acknowledge_account_subjects – If true, all other reports on content authored by this account will be resolved (acknowledged).

to_dict() dict[str, Any]#
class chitose.tools.ozone.moderation.defs.ModEventUnmute(comment: str | None = None)#

Bases: Object

Unmute action on a subject

Parameters:

comment – Describe reasoning behind the reversal.

to_dict() dict[str, Any]#
class chitose.tools.ozone.moderation.defs.ModEventUnmuteReporter(comment: str | None = None)#

Bases: Object

Unmute incoming reports from an account

Parameters:

comment – Describe reasoning behind the reversal.

to_dict() dict[str, Any]#
class chitose.tools.ozone.moderation.defs.ModEventView(id: int, event: ModEventTakedown | ModEventReverseTakedown | ModEventComment | ModEventReport | ModEventLabel | ModEventAcknowledge | ModEventEscalate | ModEventMute | ModEventUnmute | ModEventMuteReporter | ModEventUnmuteReporter | ModEventEmail | ModEventResolveAppeal | ModEventDivert | ModEventTag, subject: RepoRef | StrongRef | MessageRef, subject_blob_cids: list[str], created_by: str, created_at: str, creator_handle: str | None = None, subject_handle: str | None = None)#

Bases: Object

to_dict() dict[str, Any]#
class chitose.tools.ozone.moderation.defs.ModEventViewDetail(id: int, event: ModEventTakedown | ModEventReverseTakedown | ModEventComment | ModEventReport | ModEventLabel | ModEventAcknowledge | ModEventEscalate | ModEventMute | ModEventUnmute | ModEventMuteReporter | ModEventUnmuteReporter | ModEventEmail | ModEventResolveAppeal | ModEventDivert | ModEventTag, subject: RepoView | RepoViewNotFound | RecordView | RecordViewNotFound, subject_blobs: list[BlobView], created_by: str, created_at: str)#

Bases: Object

to_dict() dict[str, Any]#
class chitose.tools.ozone.moderation.defs.Moderation(subject_status: SubjectStatusView | None = None)#

Bases: Object

to_dict() dict[str, Any]#
class chitose.tools.ozone.moderation.defs.ModerationDetail(subject_status: SubjectStatusView | None = None)#

Bases: Object

to_dict() dict[str, Any]#
class chitose.tools.ozone.moderation.defs.RecordView(uri: str, cid: str, value: Any, blob_cids: list[str], indexed_at: str, moderation: Moderation, repo: RepoView)#

Bases: Object

to_dict() dict[str, Any]#
class chitose.tools.ozone.moderation.defs.RecordViewDetail(uri: str, cid: str, value: Any, blobs: list[BlobView], indexed_at: str, moderation: ModerationDetail, repo: RepoView, labels: list[Label] | None = None)#

Bases: Object

to_dict() dict[str, Any]#
class chitose.tools.ozone.moderation.defs.RecordViewNotFound(uri: str)#

Bases: Object

to_dict() dict[str, Any]#
class chitose.tools.ozone.moderation.defs.RepoView(did: str, handle: str, related_records: list[Any], indexed_at: str, moderation: Moderation, email: str | None = None, invited_by: InviteCode | None = None, invites_disabled: bool | None = None, invite_note: str | None = None, deactivated_at: str | None = None)#

Bases: Object

to_dict() dict[str, Any]#
class chitose.tools.ozone.moderation.defs.RepoViewDetail(did: str, handle: str, related_records: list[Any], indexed_at: str, moderation: ModerationDetail, email: str | None = None, labels: list[Label] | None = None, invited_by: InviteCode | None = None, invites: list[InviteCode] | None = None, invites_disabled: bool | None = None, invite_note: str | None = None, email_confirmed_at: str | None = None, deactivated_at: str | None = None)#

Bases: Object

to_dict() dict[str, Any]#
class chitose.tools.ozone.moderation.defs.RepoViewNotFound(did: str)#

Bases: Object

to_dict() dict[str, Any]#
class chitose.tools.ozone.moderation.defs.SubjectStatusView(id: int, subject: RepoRef | StrongRef, updated_at: str, created_at: str, review_state: Literal['#reviewOpen', '#reviewEscalated', '#reviewClosed', '#reviewNone'], subject_blob_cids: list[str] | None = None, subject_repo_handle: str | None = None, comment: str | None = None, mute_until: str | None = None, mute_reporting_until: str | None = None, last_reviewed_by: str | None = None, last_reviewed_at: str | None = None, last_reported_at: str | None = None, last_appealed_at: str | None = None, takendown: bool | None = None, appealed: bool | None = None, suspend_until: str | None = None, tags: list[str] | None = None)#

Bases: Object

Parameters:
  • updated_at – Timestamp referencing when the last update was made to the moderation status of the subject

  • created_at – Timestamp referencing the first moderation status impacting event was emitted on the subject

  • comment – Sticky comment on the subject.

  • last_appealed_at – Timestamp referencing when the author of the subject appealed a moderation action

  • appealed – True indicates that the a previously taken moderator action was appealed against, by the author of the content. False indicates last appeal was resolved by moderators.

to_dict() dict[str, Any]#
class chitose.tools.ozone.moderation.defs.VideoDetails(width: int, height: int, length: int)#

Bases: Object

to_dict() dict[str, Any]#

chitose.tools.ozone.moderation.emit_event module#

chitose.tools.ozone.moderation.get_event module#

chitose.tools.ozone.moderation.get_record module#

chitose.tools.ozone.moderation.get_records module#

chitose.tools.ozone.moderation.get_repo module#

chitose.tools.ozone.moderation.get_repos module#

chitose.tools.ozone.moderation.query_events module#

chitose.tools.ozone.moderation.query_statuses module#

chitose.tools.ozone.moderation.search_repos module#

Module contents#

class chitose.tools.ozone.moderation.Moderation_(call: Callable[[str, list[tuple[str, str | None | int | list[str]]], bytes | dict[str, Any] | None, dict[str, str]], bytes], subscribe: Callable[[str, list[tuple[str, str | None | int | list[str]]], Callable[[str | bytes], None]], None])#

Bases: object

We recommend calling methods in this class via the chitose.BskyAgent class instead of creating instances of this class directly.

emit_event(event: ModEventTakedown | ModEventAcknowledge | ModEventEscalate | ModEventComment | ModEventLabel | ModEventReport | ModEventMute | ModEventUnmute | ModEventMuteReporter | ModEventUnmuteReporter | ModEventReverseTakedown | ModEventResolveAppeal | ModEventEmail | ModEventTag, subject: RepoRef | StrongRef, created_by: str, subject_blob_cids: list[str] | None = None) bytes#

Take a moderation action on an actor.

get_event(id: int) bytes#

Get details about a moderation event.

get_record(uri: str, cid: str | None = None) bytes#

Get details about a record.

get_records(uris: list[str]) bytes#

Get details about some records.

get_repo(did: str) bytes#

Get details about a repository.

get_repos(dids: list[str]) bytes#

Get details about some repositories.

query_events(types: list[str] | None = None, created_by: str | None = None, sort_direction: str | None = None, created_after: str | None = None, created_before: str | None = None, subject: str | None = None, include_all_user_records: bool | None = None, limit: int | None = None, has_comment: bool | None = None, comment: str | None = None, added_labels: list[str] | None = None, removed_labels: list[str] | None = None, added_tags: list[str] | None = None, removed_tags: list[str] | None = None, report_types: list[str] | None = None, cursor: str | None = None) bytes#

List moderation events related to a subject.

Parameters:
  • types – The types of events (fully qualified string in the format of tools.ozone.moderation.defs#modEvent<name>) to filter by. If not specified, all events are returned.

  • sort_direction – Sort direction for the events. Defaults to descending order of created at timestamp.

  • created_after – Retrieve events created after a given timestamp

  • created_before – Retrieve events created before a given timestamp

  • include_all_user_records – If true, events on all record types (posts, lists, profile etc.) owned by the did are returned

  • has_comment – If true, only events with comments are returned

  • comment – If specified, only events with comments containing the keyword are returned

  • added_labels – If specified, only events where all of these labels were added are returned

  • removed_labels – If specified, only events where all of these labels were removed are returned

  • added_tags – If specified, only events where all of these tags were added are returned

  • removed_tags – If specified, only events where all of these tags were removed are returned

query_statuses(include_all_user_records: bool | None = None, subject: str | None = None, comment: str | None = None, reported_after: str | None = None, reported_before: str | None = None, reviewed_after: str | None = None, reviewed_before: str | None = None, include_muted: bool | None = None, only_muted: bool | None = None, review_state: str | None = None, ignore_subjects: list[str] | None = None, last_reviewed_by: str | None = None, sort_field: str | None = None, sort_direction: str | None = None, takendown: bool | None = None, appealed: bool | None = None, limit: int | None = None, tags: list[str] | None = None, exclude_tags: list[str] | None = None, cursor: str | None = None) bytes#

View moderation statuses of subjects (record or repo).

Parameters:
  • include_all_user_records – All subjects belonging to the account specified in the ‘subject’ param will be returned.

  • subject – The subject to get the status for.

  • comment – Search subjects by keyword from comments

  • reported_after – Search subjects reported after a given timestamp

  • reported_before – Search subjects reported before a given timestamp

  • reviewed_after – Search subjects reviewed after a given timestamp

  • reviewed_before – Search subjects reviewed before a given timestamp

  • include_muted – By default, we don’t include muted subjects in the results. Set this to true to include them.

  • only_muted – When set to true, only muted subjects and reporters will be returned.

  • review_state – Specify when fetching subjects in a certain state

  • last_reviewed_by – Get all subject statuses that were reviewed by a specific moderator

  • takendown – Get subjects that were taken down

  • appealed – Get subjects in unresolved appealed status

search_repos(term: str | None = None, q: str | None = None, limit: int | None = None, cursor: str | None = None) bytes#

Find repositories based on a search term.

Parameters:

term – DEPRECATED: use ‘q’ instead