kopia lustrzana https://github.com/halcy/Mastodon.py
Entity updates for 4.4.3
rodzic
304df86c42
commit
a1a0b4e306
|
@ -74,6 +74,12 @@ Return types
|
|||
.. autoclass:: mastodon.return_types.Status
|
||||
:members:
|
||||
|
||||
.. autoclass:: mastodon.return_types.Quote
|
||||
:members:
|
||||
|
||||
.. autoclass:: mastodon.return_types.ShallowQuote
|
||||
:members:
|
||||
|
||||
.. autoclass:: mastodon.return_types.StatusEdit
|
||||
:members:
|
||||
|
||||
|
@ -197,6 +203,9 @@ Return types
|
|||
.. autoclass:: mastodon.return_types.InstanceUsageUsers
|
||||
:members:
|
||||
|
||||
.. autoclass:: mastodon.return_types.RuleTranslation
|
||||
:members:
|
||||
|
||||
.. autoclass:: mastodon.return_types.Rule
|
||||
:members:
|
||||
|
||||
|
|
|
@ -285,9 +285,9 @@ class Account(AttribAccessDict):
|
|||
* 4.1.0: added
|
||||
"""
|
||||
|
||||
memorial: "bool"
|
||||
memorial: "Optional[bool]"
|
||||
"""
|
||||
Boolean indicating whether the account is an in-memoriam account.
|
||||
Boolean indicating whether the account is an in-memoriam account. (optional)
|
||||
|
||||
Version history:
|
||||
* 4.2.0: added
|
||||
|
@ -478,7 +478,15 @@ class CredentialAccountSource(AttribAccessDict):
|
|||
* 3.1.0: added
|
||||
"""
|
||||
|
||||
_version = "4.2.0"
|
||||
attribution_domains: "NonPaginatableList[str]"
|
||||
"""
|
||||
List of domains that are allowed to be shown as having published something from this user.
|
||||
|
||||
Version history:
|
||||
* 4.4.0: added
|
||||
"""
|
||||
|
||||
_version = "4.4.0"
|
||||
|
||||
class Status(AttribAccessDict):
|
||||
"""
|
||||
|
@ -738,7 +746,79 @@ class Status(AttribAccessDict):
|
|||
* 4.0.0: added
|
||||
"""
|
||||
|
||||
_version = "4.0.0"
|
||||
quote: "Optional[Union[Quote, ShallowQuote]]"
|
||||
"""
|
||||
Information about a quoted status. Can be shallow (ShallowQuote, id only) or full (Quote, full status object included). (nullable)
|
||||
|
||||
Version history:
|
||||
* 4.4.0: added
|
||||
"""
|
||||
|
||||
_version = "4.4.0"
|
||||
|
||||
class Quote(AttribAccessDict):
|
||||
"""
|
||||
A full quote of a status, including the full status object in case of an accepted quote None if the quote is not accepted.
|
||||
|
||||
Example:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# Returns a Quote object
|
||||
mastodon.status(<status id>).quote
|
||||
|
||||
See also (Mastodon API documentation): https://docs.joinmastodon.org/entities/Quote/
|
||||
"""
|
||||
|
||||
state: "str"
|
||||
"""
|
||||
The state of the quote.
|
||||
|
||||
Version history:
|
||||
* 4.4.0: added
|
||||
"""
|
||||
|
||||
quoted_status: "Optional[Status]"
|
||||
"""
|
||||
The quoted status object, if the quote has been accepted. (optional)
|
||||
|
||||
Version history:
|
||||
* 4.4.0: added
|
||||
"""
|
||||
|
||||
_version = "4.4.0"
|
||||
|
||||
class ShallowQuote(AttribAccessDict):
|
||||
"""
|
||||
A shallow quote of a status, containing only the ID of the quoted status. Used in multi-level quotes.
|
||||
|
||||
Example:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# Returns a ShallowQuote object
|
||||
mastodon.status(<status id>).quote.quoted_status.quote
|
||||
|
||||
See also (Mastodon API documentation): https://docs.joinmastodon.org/entities/ShallowQuote/
|
||||
"""
|
||||
|
||||
quoted_status_id: "Optional[MaybeSnowflakeIdType]"
|
||||
"""
|
||||
The ID of the quoted status. None if the quote is not accepted. (nullable)
|
||||
|
||||
Version history:
|
||||
* 4.4.0: added
|
||||
"""
|
||||
|
||||
state: "str"
|
||||
"""
|
||||
The state of the quote.
|
||||
|
||||
Version history:
|
||||
* 4.4.0: added
|
||||
"""
|
||||
|
||||
_version = "4.4.0"
|
||||
|
||||
class StatusEdit(AttribAccessDict):
|
||||
"""
|
||||
|
@ -1076,7 +1156,15 @@ class ScheduledStatusParams(AttribAccessDict):
|
|||
* 2.7.0: added
|
||||
"""
|
||||
|
||||
_version = "2.8.0"
|
||||
quoted_status_id: "Optional[MaybeSnowflakeIdType]"
|
||||
"""
|
||||
ID for a status this status will quote, once posted. (nullable)
|
||||
|
||||
Version history:
|
||||
* 4.4.0: added
|
||||
"""
|
||||
|
||||
_version = "4.4.0"
|
||||
|
||||
class Poll(AttribAccessDict):
|
||||
"""
|
||||
|
@ -1333,7 +1421,15 @@ class Tag(AttribAccessDict):
|
|||
* 3.5.0: added
|
||||
"""
|
||||
|
||||
_version = "4.0.0"
|
||||
featuring: "Optional[bool]"
|
||||
"""
|
||||
Whether the hashtag is featured on the logged-in users profile. (optional)
|
||||
|
||||
Version history:
|
||||
* 4.4.0: added
|
||||
"""
|
||||
|
||||
_version = "4.4.0"
|
||||
|
||||
class TagHistory(AttribAccessDict):
|
||||
"""
|
||||
|
@ -3158,7 +3254,15 @@ class InstanceConfigurationV2(AttribAccessDict):
|
|||
* 4.3.0: added
|
||||
"""
|
||||
|
||||
_version = "4.3.0"
|
||||
limited_federation: "bool"
|
||||
"""
|
||||
Whether federation on this instance is limited to explicitly allowed domains ('allowlist mode').
|
||||
|
||||
Version history:
|
||||
* 4.4.0: added
|
||||
"""
|
||||
|
||||
_version = "4.4.0"
|
||||
|
||||
class InstanceVapidKey(AttribAccessDict):
|
||||
"""
|
||||
|
@ -3216,7 +3320,34 @@ class InstanceURLsV2(AttribAccessDict):
|
|||
* 4.0.0: added
|
||||
"""
|
||||
|
||||
_version = "4.0.0"
|
||||
about: "Optional[str]"
|
||||
"""
|
||||
If present, a URL where the instance's about page can be found. (optional)
|
||||
Should contain (as text): URL
|
||||
|
||||
Version history:
|
||||
* 4.4.0: added
|
||||
"""
|
||||
|
||||
privacy_policy: "Optional[str]"
|
||||
"""
|
||||
If present, a URL where the instance's privacy policy can be found. (optional)
|
||||
Should contain (as text): URL
|
||||
|
||||
Version history:
|
||||
* 4.4.0: added
|
||||
"""
|
||||
|
||||
terms_of_service: "Optional[str]"
|
||||
"""
|
||||
If present, a URL where the instance's terms of service can be found. (optional)
|
||||
Should contain (as text): URL
|
||||
|
||||
Version history:
|
||||
* 4.4.0: added
|
||||
"""
|
||||
|
||||
_version = "4.4.0"
|
||||
|
||||
class InstanceThumbnail(AttribAccessDict):
|
||||
"""
|
||||
|
@ -3386,6 +3517,38 @@ class InstanceUsageUsers(AttribAccessDict):
|
|||
|
||||
_version = "3.0.0"
|
||||
|
||||
class RuleTranslation(AttribAccessDict):
|
||||
"""
|
||||
A translation for a rule into a specific language.
|
||||
|
||||
Example:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# Returns a RuleTranslation object
|
||||
mastodon.instance().rules[0].translations['de']
|
||||
|
||||
See also (Mastodon API documentation): https://docs.joinmastodon.org/entities/Rule/#translations
|
||||
"""
|
||||
|
||||
text: "str"
|
||||
"""
|
||||
The rule to be followed, in few words, in the specified language.
|
||||
|
||||
Version history:
|
||||
* 4.4.0: added
|
||||
"""
|
||||
|
||||
hint: "str"
|
||||
"""
|
||||
Potentially, the rule to be followed, in more words, in the specified language.
|
||||
|
||||
Version history:
|
||||
* 4.4.0: added
|
||||
"""
|
||||
|
||||
_version = "4.4.0"
|
||||
|
||||
class Rule(AttribAccessDict):
|
||||
"""
|
||||
A rule that instance staff has specified users must follow on this instance.
|
||||
|
@ -3424,7 +3587,15 @@ class Rule(AttribAccessDict):
|
|||
* 4.3.0: added
|
||||
"""
|
||||
|
||||
_version = "4.3.0"
|
||||
translations: "AttribAccessDict[str, RuleTranslation]"
|
||||
"""
|
||||
A list of translations for the rule, as a dictionary with the key being ISO 639-1 (two-letter) language codes for available languages.
|
||||
|
||||
Version history:
|
||||
* 4.4.0: added
|
||||
"""
|
||||
|
||||
_version = "4.4.0"
|
||||
|
||||
class InstanceRegistrations(AttribAccessDict):
|
||||
"""
|
||||
|
@ -3467,11 +3638,11 @@ class InstanceRegistrations(AttribAccessDict):
|
|||
|
||||
url: "Optional[str]"
|
||||
"""
|
||||
Presumably, a registration related URL. It is unclear what this is for. (nullable)
|
||||
A custom URL for account registration, when using external authentication. (nullable)
|
||||
Should contain (as text): URL
|
||||
|
||||
Version history:
|
||||
* 4.0.0: added
|
||||
* 4.2.0: added
|
||||
"""
|
||||
|
||||
sign_up_url: "Optional[str]"
|
||||
|
@ -3482,7 +3653,23 @@ class InstanceRegistrations(AttribAccessDict):
|
|||
* 4.2.0: added
|
||||
"""
|
||||
|
||||
_version = "4.2.0"
|
||||
reason_required: "Optional[bool]"
|
||||
"""
|
||||
Boolean indicating whether a reason for registration is required on this instance. (nullable)
|
||||
|
||||
Version history:
|
||||
* 4.4.0: added
|
||||
"""
|
||||
|
||||
min_age: "Optional[int]"
|
||||
"""
|
||||
Minimum age in years required to register on this instance. (nullable)
|
||||
|
||||
Version history:
|
||||
* 4.4.0: added
|
||||
"""
|
||||
|
||||
_version = "4.4.0"
|
||||
|
||||
class InstanceContact(AttribAccessDict):
|
||||
"""
|
||||
|
@ -3675,7 +3862,15 @@ class InstanceMediaConfiguration(AttribAccessDict):
|
|||
* 3.4.2: added
|
||||
"""
|
||||
|
||||
_version = "3.4.2"
|
||||
description_limit: "int"
|
||||
"""
|
||||
Maximum number of characters in a media attachment description this instance allows local users to use.
|
||||
|
||||
Version history:
|
||||
* 4.4.0: added
|
||||
"""
|
||||
|
||||
_version = "4.4.0"
|
||||
|
||||
class InstancePollConfiguration(AttribAccessDict):
|
||||
"""
|
||||
|
@ -3789,7 +3984,7 @@ class Nodeinfo(AttribAccessDict):
|
|||
|
||||
metadata: "NodeinfoMetadata"
|
||||
"""
|
||||
Additional node metadata. On Mastodon, typically an empty object with no fields.
|
||||
Additional node metadata. Can be entirely empty.
|
||||
|
||||
Version history:
|
||||
* 3.0.0: added
|
||||
|
@ -3947,7 +4142,23 @@ class NodeinfoMetadata(AttribAccessDict):
|
|||
See also (Mastodon API documentation): https://github.com/jhass/nodeinfo
|
||||
"""
|
||||
|
||||
_version = "0.0.0"
|
||||
nodeName: "str"
|
||||
"""
|
||||
Name of the instance, as specified by the instance admin.
|
||||
|
||||
Version history:
|
||||
* 4.4.0: added
|
||||
"""
|
||||
|
||||
nodeDescription: "Optional[str]"
|
||||
"""
|
||||
Description of the instance, as specified by the instance admin. (nullable)
|
||||
|
||||
Version history:
|
||||
* 4.4.0: added
|
||||
"""
|
||||
|
||||
_version = "4.4.0"
|
||||
|
||||
class Activity(AttribAccessDict):
|
||||
"""
|
||||
|
@ -4283,7 +4494,15 @@ class WebPushSubscription(AttribAccessDict):
|
|||
* 2.4.0: added
|
||||
"""
|
||||
|
||||
_version = "4.0.0"
|
||||
standard: "bool"
|
||||
"""
|
||||
Boolean indicatign whether the push messages follow the standardized specifications (RFC8030+RFC8291+RFC8292). Else they follow a legacy version of the specifications (4th draft of RFC8291 and 1st draft of RFC8292).
|
||||
|
||||
Version history:
|
||||
* 4.4.0: added
|
||||
"""
|
||||
|
||||
_version = "4.4.0"
|
||||
|
||||
class WebPushSubscriptionAlerts(AttribAccessDict):
|
||||
"""
|
||||
|
@ -4784,18 +5003,18 @@ class Reaction(AttribAccessDict):
|
|||
* 3.1.0: added
|
||||
"""
|
||||
|
||||
url: "str"
|
||||
url: "Optional[str]"
|
||||
"""
|
||||
URL for the custom emoji image.
|
||||
URL for the custom emoji image. (nullable)
|
||||
Should contain (as text): URL
|
||||
|
||||
Version history:
|
||||
* 3.1.0: added
|
||||
"""
|
||||
|
||||
static_url: "str"
|
||||
static_url: "Optional[str]"
|
||||
"""
|
||||
URL for a never-animated version of the custom emoji image.
|
||||
URL for a never-animated version of the custom emoji image. (nullable)
|
||||
Should contain (as text): URL
|
||||
|
||||
Version history:
|
||||
|
@ -5690,9 +5909,9 @@ class DomainBlock(AttribAccessDict):
|
|||
* 4.0.0: added
|
||||
"""
|
||||
|
||||
comment: "str"
|
||||
comment: "Optional[str]"
|
||||
"""
|
||||
An optional reason for the domain block.
|
||||
An optional reason for the domain block. (nullable)
|
||||
|
||||
Version history:
|
||||
* 4.0.0: added
|
||||
|
@ -6081,7 +6300,15 @@ class AccountCreationErrorDetails(AttribAccessDict):
|
|||
* 3.4.0: added
|
||||
"""
|
||||
|
||||
_version = "3.4.0"
|
||||
date_of_birth: "Optional[NonPaginatableList[AccountCreationErrorDetailsField]]"
|
||||
"""
|
||||
An object giving more details about an error caused by the date of birth. (optional)
|
||||
|
||||
Version history:
|
||||
* 4.4.0: added
|
||||
"""
|
||||
|
||||
_version = "4.4.0"
|
||||
|
||||
class AccountCreationErrorDetailsField(AttribAccessDict):
|
||||
"""
|
||||
|
@ -6889,6 +7116,8 @@ ENTITY_NAME_MAP = {
|
|||
"Role": Role,
|
||||
"CredentialAccountSource": CredentialAccountSource,
|
||||
"Status": Status,
|
||||
"Quote": Quote,
|
||||
"ShallowQuote": ShallowQuote,
|
||||
"StatusEdit": StatusEdit,
|
||||
"FilterResult": FilterResult,
|
||||
"StatusMention": StatusMention,
|
||||
|
@ -6932,6 +7161,7 @@ ENTITY_NAME_MAP = {
|
|||
"InstanceStatistics": InstanceStatistics,
|
||||
"InstanceUsage": InstanceUsage,
|
||||
"InstanceUsageUsers": InstanceUsageUsers,
|
||||
"RuleTranslation": RuleTranslation,
|
||||
"Rule": Rule,
|
||||
"InstanceRegistrations": InstanceRegistrations,
|
||||
"InstanceContact": InstanceContact,
|
||||
|
@ -7003,6 +7233,8 @@ __all__ = [
|
|||
"Role",
|
||||
"CredentialAccountSource",
|
||||
"Status",
|
||||
"Quote",
|
||||
"ShallowQuote",
|
||||
"StatusEdit",
|
||||
"FilterResult",
|
||||
"StatusMention",
|
||||
|
@ -7046,6 +7278,7 @@ __all__ = [
|
|||
"InstanceStatistics",
|
||||
"InstanceUsage",
|
||||
"InstanceUsageUsers",
|
||||
"RuleTranslation",
|
||||
"Rule",
|
||||
"InstanceRegistrations",
|
||||
"InstanceContact",
|
||||
|
|
|
@ -191,24 +191,25 @@ if sys.version_info < (3, 9):
|
|||
# I'm sorry about this, but I cannot think of another way to make this work properly in versions below 3.9 that
|
||||
# cannot resolve forward references in a sane way
|
||||
from mastodon.return_types import Account, AccountField, Role, CredentialAccountSource, \
|
||||
Status, StatusEdit, FilterResult, StatusMention, ScheduledStatus, ScheduledStatusParams, \
|
||||
Poll, PollOption, Conversation, Tag, TagHistory, CustomEmoji, \
|
||||
Application, Relationship, Filter, FilterV2, Notification, Context, \
|
||||
UserList, MediaAttachment, MediaAttachmentMetadataContainer, MediaAttachmentImageMetadata, MediaAttachmentVideoMetadata, MediaAttachmentAudioMetadata, \
|
||||
MediaAttachmentFocusPoint, MediaAttachmentColors, PreviewCard, TrendingLinkHistory, PreviewCardAuthor, Search, \
|
||||
SearchV2, Instance, InstanceConfiguration, InstanceURLs, InstanceV2, InstanceIcon, \
|
||||
InstanceConfigurationV2, InstanceVapidKey, InstanceURLsV2, InstanceThumbnail, InstanceThumbnailVersions, InstanceStatistics, \
|
||||
InstanceUsage, InstanceUsageUsers, Rule, InstanceRegistrations, InstanceContact, InstanceAccountConfiguration, \
|
||||
InstanceStatusConfiguration, InstanceTranslationConfiguration, InstanceMediaConfiguration, InstancePollConfiguration, Nodeinfo, NodeinfoSoftware, \
|
||||
NodeinfoServices, NodeinfoUsage, NodeinfoUsageUsers, NodeinfoMetadata, Activity, Report, \
|
||||
AdminReport, WebPushSubscription, WebPushSubscriptionAlerts, PushNotification, Preferences, FeaturedTag, \
|
||||
Marker, Announcement, Reaction, StreamReaction, FamiliarFollowers, AdminAccount, \
|
||||
AdminIp, AdminMeasure, AdminMeasureData, AdminDimension, AdminDimensionData, AdminRetention, \
|
||||
AdminCohort, AdminDomainBlock, AdminCanonicalEmailBlock, AdminDomainAllow, AdminEmailDomainBlock, AdminEmailDomainBlockHistory, \
|
||||
AdminIpBlock, DomainBlock, ExtendedDescription, FilterKeyword, FilterStatus, IdentityProof, \
|
||||
StatusSource, Suggestion, Translation, AccountCreationError, AccountCreationErrorDetails, AccountCreationErrorDetailsField, \
|
||||
NotificationPolicy, NotificationPolicySummary, RelationshipSeveranceEvent, GroupedNotificationsResults, PartialAccountWithAvatar, NotificationGroup, \
|
||||
AccountWarning, UnreadNotificationsCount, Appeal, NotificationRequest, SupportedLocale, OAuthServerInfo
|
||||
Status, Quote, ShallowQuote, StatusEdit, FilterResult, StatusMention, \
|
||||
ScheduledStatus, ScheduledStatusParams, Poll, PollOption, Conversation, Tag, \
|
||||
TagHistory, CustomEmoji, Application, Relationship, Filter, FilterV2, \
|
||||
Notification, Context, UserList, MediaAttachment, MediaAttachmentMetadataContainer, MediaAttachmentImageMetadata, \
|
||||
MediaAttachmentVideoMetadata, MediaAttachmentAudioMetadata, MediaAttachmentFocusPoint, MediaAttachmentColors, PreviewCard, TrendingLinkHistory, \
|
||||
PreviewCardAuthor, Search, SearchV2, Instance, InstanceConfiguration, InstanceURLs, \
|
||||
InstanceV2, InstanceIcon, InstanceConfigurationV2, InstanceVapidKey, InstanceURLsV2, InstanceThumbnail, \
|
||||
InstanceThumbnailVersions, InstanceStatistics, InstanceUsage, InstanceUsageUsers, RuleTranslation, Rule, \
|
||||
InstanceRegistrations, InstanceContact, InstanceAccountConfiguration, InstanceStatusConfiguration, InstanceTranslationConfiguration, InstanceMediaConfiguration, \
|
||||
InstancePollConfiguration, Nodeinfo, NodeinfoSoftware, NodeinfoServices, NodeinfoUsage, NodeinfoUsageUsers, \
|
||||
NodeinfoMetadata, Activity, Report, AdminReport, WebPushSubscription, WebPushSubscriptionAlerts, \
|
||||
PushNotification, Preferences, FeaturedTag, Marker, Announcement, Reaction, \
|
||||
StreamReaction, FamiliarFollowers, AdminAccount, AdminIp, AdminMeasure, AdminMeasureData, \
|
||||
AdminDimension, AdminDimensionData, AdminRetention, AdminCohort, AdminDomainBlock, AdminCanonicalEmailBlock, \
|
||||
AdminDomainAllow, AdminEmailDomainBlock, AdminEmailDomainBlockHistory, AdminIpBlock, DomainBlock, ExtendedDescription, \
|
||||
FilterKeyword, FilterStatus, IdentityProof, StatusSource, Suggestion, Translation, \
|
||||
AccountCreationError, AccountCreationErrorDetails, AccountCreationErrorDetailsField, NotificationPolicy, NotificationPolicySummary, RelationshipSeveranceEvent, \
|
||||
GroupedNotificationsResults, PartialAccountWithAvatar, NotificationGroup, AccountWarning, UnreadNotificationsCount, Appeal, \
|
||||
NotificationRequest, SupportedLocale, OAuthServerInfo
|
||||
if isinstance(t, ForwardRef):
|
||||
try:
|
||||
t = t._evaluate(globals(), locals(), frozenset())
|
||||
|
@ -295,6 +296,12 @@ def try_cast(t, value, retry = True, union_specializer = None):
|
|||
if union_specializer is not None:
|
||||
value["__union_specializer"] = union_specializer
|
||||
value = t(**value)
|
||||
|
||||
# Did we have type arguments on the dict? If so, we need to try to cast the values
|
||||
if hasattr(t, '__args__') and len(t.__args__) > 1:
|
||||
value_cast_type = t.__args__[1]
|
||||
for key, val in value.items():
|
||||
value[key] = try_cast_recurse(value_cast_type, val, union_specializer)
|
||||
elif real_issubclass(t, bool):
|
||||
if isinstance(value, str):
|
||||
if value.lower() == 'true':
|
||||
|
@ -343,6 +350,9 @@ def try_cast(t, value, retry = True, union_specializer = None):
|
|||
else:
|
||||
value = t(value)
|
||||
except Exception as e:
|
||||
# Failures are silently ignored, usually.
|
||||
# import traceback
|
||||
# traceback.print_exc()
|
||||
if retry and isinstance(value, dict):
|
||||
value = try_cast(AttribAccessDict, value, False, union_specializer)
|
||||
return value
|
||||
|
@ -352,6 +362,7 @@ def try_cast_recurse(t, value, union_specializer=None):
|
|||
Non-dict compound type casting function. Handles:
|
||||
* Casting to list, tuple, EntityList or (Non)PaginatableList, converting all elements to the correct type recursively
|
||||
* Casting to Union, use union_specializer to special case the union type to the correct one
|
||||
* Casting to Union, special case out Quote vs ShallowQuote by the presence of "quoted_status" or "quoted_status_id" in the value
|
||||
* Casting to Union, trying all types in the union until one works
|
||||
Gives up and returns as-is if none of the above work.
|
||||
"""
|
||||
|
@ -384,6 +395,12 @@ def try_cast_recurse(t, value, union_specializer=None):
|
|||
"audio": MediaAttachmentAudioMetadata,
|
||||
"gifv": MediaAttachmentVideoMetadata,
|
||||
}.get(union_specializer, None)
|
||||
if isinstance(value, dict) and "quoted_status_id" in value:
|
||||
from mastodon.return_types import ShallowQuote
|
||||
real_type = ShallowQuote
|
||||
elif isinstance(value, dict) and "quoted_status" in value:
|
||||
from mastodon.return_types import Quote
|
||||
real_type = Quote
|
||||
if real_type in t.__args__:
|
||||
value = try_cast_recurse(real_type, value, union_specializer)
|
||||
use_real_type = True
|
||||
|
@ -405,6 +422,8 @@ def try_cast_recurse(t, value, union_specializer=None):
|
|||
value = try_cast(t, value, True, union_specializer)
|
||||
except Exception as e:
|
||||
# Failures are silently ignored. We care about maximum not breaking here.
|
||||
# import traceback
|
||||
# traceback.print_exc()
|
||||
pass
|
||||
|
||||
if real_issubclass(value.__class__, AttribAccessDict) or real_issubclass(value.__class__, PaginatableList) or real_issubclass(value.__class__, NonPaginatableList) or real_issubclass(value.__class__, MaybeSnowflakeIdType):
|
||||
|
@ -673,8 +692,16 @@ class AttribAccessDict(OrderedStrDict, Entity):
|
|||
# If we're already an AttribAccessDict subclass, skip all the casting
|
||||
if not isinstance(val, AttribAccessDict):
|
||||
# Collate type hints that we may have
|
||||
type_hints = get_type_hints(self.__class__)
|
||||
init_hints = get_type_hints(self.__class__.__init__)
|
||||
type_hints = {}
|
||||
try:
|
||||
type_hints = get_type_hints(self.__class__)
|
||||
except:
|
||||
pass
|
||||
init_hints = {}
|
||||
try:
|
||||
init_hints = get_type_hints(self.__class__.__init__)
|
||||
except:
|
||||
pass
|
||||
type_hints.update(init_hints)
|
||||
|
||||
# Ugly hack: We have to specialize unions by hand because you can't just guess by content generally
|
||||
|
|
|
@ -481,7 +481,7 @@
|
|||
"description": "Boolean indicating whether the account is an in-memoriam account.",
|
||||
"field_type": "bool",
|
||||
"field_subtype": null,
|
||||
"is_optional": false,
|
||||
"is_optional": true,
|
||||
"is_nullable": false,
|
||||
"version_history": [
|
||||
[
|
||||
|
@ -773,6 +773,23 @@
|
|||
]
|
||||
],
|
||||
"enum": null
|
||||
},
|
||||
"attribution_domains": {
|
||||
"description": "List of domains that are allowed to be shown as having published something from this user.",
|
||||
"field_type": "NonPaginatableList",
|
||||
"field_subtype": "str",
|
||||
"is_optional": false,
|
||||
"is_nullable": false,
|
||||
"version_history": [
|
||||
[
|
||||
"4.4.0",
|
||||
"added"
|
||||
]
|
||||
],
|
||||
"api_version_list": [
|
||||
3
|
||||
],
|
||||
"enum": null
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -1197,6 +1214,115 @@
|
|||
"added"
|
||||
]
|
||||
]
|
||||
},
|
||||
"quote": {
|
||||
"description": "Information about a quoted status. Can be shallow (ShallowQuote, id only) or full (Quote, full status object included).",
|
||||
"field_type": "Union[Quote, ShallowQuote]",
|
||||
"field_subtype": null,
|
||||
"is_optional": false,
|
||||
"is_nullable": true,
|
||||
"version_history": [
|
||||
[
|
||||
"4.4.0",
|
||||
"added"
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Quote",
|
||||
"python_name": "Quote",
|
||||
"func_call": "mastodon.status(<status id>).quote",
|
||||
"func_call_real": "mastodon.status(115044073088181107).quote",
|
||||
"masto_doc_link": "https://docs.joinmastodon.org/entities/Quote/",
|
||||
"func_call_additional": null,
|
||||
"func_alternate_acc": false,
|
||||
"manual_update": false,
|
||||
"description": "A full quote of a status, including the full status object in case of an accepted quote None if the quote is not accepted.",
|
||||
"fields": {
|
||||
"state": {
|
||||
"description": "The state of the quote.",
|
||||
"field_type": "str",
|
||||
"field_subtype": null,
|
||||
"is_optional": false,
|
||||
"is_nullable": false,
|
||||
"version_history": [
|
||||
[
|
||||
"4.4.0",
|
||||
"added"
|
||||
]
|
||||
],
|
||||
"enum": {
|
||||
"pending": "The quote has not been acknowledged by the quoted account yet, and requires authorization before being displayed.",
|
||||
"accepted": "The quote has been approved by the quoted account and can be displayed. This is the only case where quoted_status is non-null.",
|
||||
"rejected": "The quote has been explicitly rejected by the quoted account, and should not be displayed.",
|
||||
"revoked": "The quote was approved by the quoted account originally, but permission has since been revoked by the quoted account, and it should not be displayed.",
|
||||
"deleted": "The quote was approved by the quoted account originally, but the quoted status has since been deleted.",
|
||||
"unauthorized": "The quote has been approved by the quoted account, but the logged-on user is not authorized to see the quoted status."
|
||||
}
|
||||
},
|
||||
"quoted_status": {
|
||||
"description": "The quoted status object, if the quote has been accepted.",
|
||||
"field_type": "Status",
|
||||
"field_subtype": null,
|
||||
"is_optional": true,
|
||||
"is_nullable": false,
|
||||
"version_history": [
|
||||
[
|
||||
"4.4.0",
|
||||
"added"
|
||||
]
|
||||
],
|
||||
"enum": null
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Shallow quote",
|
||||
"python_name": "ShallowQuote",
|
||||
"func_call": "mastodon.status(<status id>).quote.quoted_status.quote",
|
||||
"func_call_real": "mastodon.status(115044073088181107).quote.quoted_status.quote",
|
||||
"masto_doc_link": "https://docs.joinmastodon.org/entities/ShallowQuote/",
|
||||
"func_call_additional": null,
|
||||
"func_alternate_acc": false,
|
||||
"manual_update": false,
|
||||
"description": "A shallow quote of a status, containing only the ID of the quoted status. Used in multi-level quotes.",
|
||||
"fields": {
|
||||
"quoted_status_id": {
|
||||
"description": "The ID of the quoted status. None if the quote is not accepted.",
|
||||
"field_type": "MaybeSnowflakeIdType",
|
||||
"field_subtype": null,
|
||||
"is_optional": false,
|
||||
"is_nullable": true,
|
||||
"version_history": [
|
||||
[
|
||||
"4.4.0",
|
||||
"added"
|
||||
]
|
||||
],
|
||||
"enum": null
|
||||
},
|
||||
"state": {
|
||||
"description": "The state of the quote.",
|
||||
"field_type": "str",
|
||||
"field_subtype": null,
|
||||
"is_optional": false,
|
||||
"is_nullable": false,
|
||||
"version_history": [
|
||||
[
|
||||
"4.4.0",
|
||||
"added"
|
||||
]
|
||||
],
|
||||
"enum": {
|
||||
"pending": "The quote has not been acknowledged by the quoted account yet, and requires authorization before being displayed.",
|
||||
"accepted": "The quote has been approved by the quoted account and can be displayed. This is the only case where quoted_status_id is non-null.",
|
||||
"rejected": "The quote has been explicitly rejected by the quoted account, and should not be displayed.",
|
||||
"revoked": "The quote was approved by the quoted account originally, but permission has since been revoked by the quoted account, and it should not be displayed.",
|
||||
"deleted": "The quote was approved by the quoted account originally, but the quoted status has since been deleted.",
|
||||
"unauthorized": "The quote has been approved by the quoted account, but the logged-in user is not authorized to see the quoted status."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -1711,6 +1837,20 @@
|
|||
]
|
||||
],
|
||||
"enum": null
|
||||
},
|
||||
"quoted_status_id": {
|
||||
"description": "ID for a status this status will quote, once posted.",
|
||||
"field_type": "MaybeSnowflakeIdType",
|
||||
"field_subtype": null,
|
||||
"is_optional": false,
|
||||
"is_nullable": true,
|
||||
"version_history": [
|
||||
[
|
||||
"4.4.0",
|
||||
"added"
|
||||
]
|
||||
],
|
||||
"enum": null
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -2099,6 +2239,20 @@
|
|||
]
|
||||
],
|
||||
"enum": null
|
||||
},
|
||||
"featuring": {
|
||||
"description": "Whether the hashtag is featured on the logged-in users profile.",
|
||||
"field_type": "bool",
|
||||
"field_subtype": null,
|
||||
"is_optional": true,
|
||||
"is_nullable": false,
|
||||
"version_history": [
|
||||
[
|
||||
"4.4.0",
|
||||
"added"
|
||||
]
|
||||
],
|
||||
"enum": null
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -4882,6 +5036,19 @@
|
|||
"added"
|
||||
]
|
||||
]
|
||||
},
|
||||
"limited_federation": {
|
||||
"description": "Whether federation on this instance is limited to explicitly allowed domains ('allowlist mode')",
|
||||
"field_type": "bool",
|
||||
"field_subtype": null,
|
||||
"is_optional": false,
|
||||
"is_nullable": false,
|
||||
"version_history": [
|
||||
[
|
||||
"4.4.0",
|
||||
"added"
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -4954,6 +5121,48 @@
|
|||
"added"
|
||||
]
|
||||
]
|
||||
},
|
||||
"about": {
|
||||
"description": "If present, a URL where the instance's about page can be found.",
|
||||
"field_type": "str",
|
||||
"field_subtype": null,
|
||||
"is_optional": true,
|
||||
"is_nullable": false,
|
||||
"field_structuretype": "URL",
|
||||
"version_history": [
|
||||
[
|
||||
"4.4.0",
|
||||
"added"
|
||||
]
|
||||
]
|
||||
},
|
||||
"privacy_policy": {
|
||||
"description": "If present, a URL where the instance's privacy policy can be found.",
|
||||
"field_type": "str",
|
||||
"field_subtype": null,
|
||||
"is_optional": true,
|
||||
"is_nullable": false,
|
||||
"field_structuretype": "URL",
|
||||
"version_history": [
|
||||
[
|
||||
"4.4.0",
|
||||
"added"
|
||||
]
|
||||
]
|
||||
},
|
||||
"terms_of_service": {
|
||||
"description": "If present, a URL where the instance's terms of service can be found.",
|
||||
"field_type": "str",
|
||||
"field_subtype": null,
|
||||
"is_optional": true,
|
||||
"is_nullable": false,
|
||||
"field_structuretype": "URL",
|
||||
"version_history": [
|
||||
[
|
||||
"4.4.0",
|
||||
"added"
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -5163,6 +5372,47 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Rule translation",
|
||||
"python_name": "RuleTranslation",
|
||||
"func_call": "mastodon.instance().rules[0].translations['de']",
|
||||
"masto_doc_link": "https://docs.joinmastodon.org/entities/Rule/#translations",
|
||||
"func_call_real": null,
|
||||
"func_call_additional": null,
|
||||
"func_alternate_acc": false,
|
||||
"manual_update": false,
|
||||
"description": "A translation for a rule into a specific language.",
|
||||
"fields": {
|
||||
"text": {
|
||||
"description": "The rule to be followed, in few words, in the specified language.",
|
||||
"field_type": "str",
|
||||
"field_subtype": null,
|
||||
"is_optional": false,
|
||||
"is_nullable": false,
|
||||
"version_history": [
|
||||
[
|
||||
"4.4.0",
|
||||
"added"
|
||||
]
|
||||
],
|
||||
"enum": null
|
||||
},
|
||||
"hint": {
|
||||
"description": "Potentially, the rule to be followed, in more words, in the specified language.",
|
||||
"field_type": "str",
|
||||
"field_subtype": null,
|
||||
"is_optional": false,
|
||||
"is_nullable": false,
|
||||
"version_history": [
|
||||
[
|
||||
"4.4.0",
|
||||
"added"
|
||||
]
|
||||
],
|
||||
"enum": null
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Instance rule",
|
||||
"python_name": "Rule",
|
||||
|
@ -5215,6 +5465,20 @@
|
|||
]
|
||||
],
|
||||
"enum": null
|
||||
},
|
||||
"translations": {
|
||||
"description": "A list of translations for the rule, as a dictionary with the key being ISO 639-1 (two-letter) language codes for available languages.",
|
||||
"field_type": "AttribAccessDict[str, RuleTranslation]",
|
||||
"field_subtype": null,
|
||||
"is_optional": false,
|
||||
"is_nullable": false,
|
||||
"version_history": [
|
||||
[
|
||||
"4.4.0",
|
||||
"added"
|
||||
]
|
||||
],
|
||||
"enum": null
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -5270,7 +5534,7 @@
|
|||
]
|
||||
},
|
||||
"url": {
|
||||
"description": "Presumably, a registration related URL. It is unclear what this is for.",
|
||||
"description": "A custom URL for account registration, when using external authentication.",
|
||||
"field_type": "str",
|
||||
"help_wanted": true,
|
||||
"field_subtype": null,
|
||||
|
@ -5279,7 +5543,7 @@
|
|||
"field_structuretype": "URL",
|
||||
"version_history": [
|
||||
[
|
||||
"4.0.0",
|
||||
"4.2.0",
|
||||
"added"
|
||||
]
|
||||
]
|
||||
|
@ -5297,7 +5561,33 @@
|
|||
"added"
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"reason_required": {
|
||||
"description": "Boolean indicating whether a reason for registration is required on this instance.",
|
||||
"field_type": "bool",
|
||||
"field_subtype": null,
|
||||
"is_optional": false,
|
||||
"is_nullable": true,
|
||||
"version_history": [
|
||||
[
|
||||
"4.4.0",
|
||||
"added"
|
||||
]
|
||||
]
|
||||
},
|
||||
"min_age": {
|
||||
"description": "Minimum age in years required to register on this instance.",
|
||||
"field_type": "int",
|
||||
"field_subtype": null,
|
||||
"is_optional": false,
|
||||
"is_nullable": true,
|
||||
"version_history": [
|
||||
[
|
||||
"4.4.0",
|
||||
"added"
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -5545,6 +5835,19 @@
|
|||
"added"
|
||||
]
|
||||
]
|
||||
},
|
||||
"description_limit": {
|
||||
"description": "Maximum number of characters in a media attachment description this instance allows local users to use.",
|
||||
"field_type": "int",
|
||||
"field_subtype": null,
|
||||
"is_optional": false,
|
||||
"is_nullable": false,
|
||||
"version_history": [
|
||||
[
|
||||
"4.4.0",
|
||||
"added"
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -5703,7 +6006,7 @@
|
|||
]
|
||||
},
|
||||
"metadata": {
|
||||
"description": "Additional node metadata. On Mastodon, typically an empty object with no fields.",
|
||||
"description": "Additional node metadata. Can be entirely empty.",
|
||||
"field_type": "NodeinfoMetadata",
|
||||
"field_subtype": null,
|
||||
"is_optional": false,
|
||||
|
@ -5892,7 +6195,34 @@
|
|||
"masto_doc_link": "https://github.com/jhass/nodeinfo",
|
||||
"func_call": "mastodon.instance_nodeinfo().metadata",
|
||||
"description": "Nodeinfo extra metadata. Entirely freeform, be careful about consuming it programatically. Survey of real world usage: https://codeberg.org/thefederationinfo/nodeinfo_metadata_survey",
|
||||
"fields": {}
|
||||
"fields": {
|
||||
"nodeName": {
|
||||
"description": "Name of the instance, as specified by the instance admin.",
|
||||
"field_type": "str",
|
||||
"field_subtype": null,
|
||||
"is_optional": false,
|
||||
"is_nullable": false,
|
||||
"version_history": [
|
||||
[
|
||||
"4.4.0",
|
||||
"added"
|
||||
]
|
||||
]
|
||||
},
|
||||
"nodeDescription": {
|
||||
"description": "Description of the instance, as specified by the instance admin.",
|
||||
"field_type": "str",
|
||||
"field_subtype": null,
|
||||
"is_optional": false,
|
||||
"is_nullable": true,
|
||||
"version_history": [
|
||||
[
|
||||
"4.4.0",
|
||||
"added"
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Activity",
|
||||
|
@ -6430,6 +6760,19 @@
|
|||
"added"
|
||||
]
|
||||
]
|
||||
},
|
||||
"standard": {
|
||||
"description": "Boolean indicatign whether the push messages follow the standardized specifications (RFC8030+RFC8291+RFC8292). Else they follow a legacy version of the specifications (4th draft of RFC8291 and 1st draft of RFC8292).",
|
||||
"field_type": "bool",
|
||||
"field_subtype": null,
|
||||
"is_optional": false,
|
||||
"is_nullable": false,
|
||||
"version_history": [
|
||||
[
|
||||
"4.4.0",
|
||||
"added"
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -7209,7 +7552,7 @@
|
|||
"field_type": "str",
|
||||
"field_subtype": null,
|
||||
"is_optional": false,
|
||||
"is_nullable": false,
|
||||
"is_nullable": true,
|
||||
"field_structuretype": "URL",
|
||||
"version_history": [
|
||||
[
|
||||
|
@ -7224,7 +7567,7 @@
|
|||
"field_type": "str",
|
||||
"field_subtype": null,
|
||||
"is_optional": false,
|
||||
"is_nullable": false,
|
||||
"is_nullable": true,
|
||||
"field_structuretype": "URL",
|
||||
"version_history": [
|
||||
[
|
||||
|
@ -8588,7 +8931,7 @@
|
|||
"field_subtype": null,
|
||||
"field_structuretype": null,
|
||||
"is_optional": false,
|
||||
"is_nullable": false
|
||||
"is_nullable": true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -9153,6 +9496,21 @@
|
|||
"field_structuretype": null,
|
||||
"is_optional": true,
|
||||
"is_nullable": false
|
||||
},
|
||||
"date_of_birth": {
|
||||
"description": "An object giving more details about an error caused by the date of birth.",
|
||||
"enum": null,
|
||||
"version_history": [
|
||||
[
|
||||
"4.4.0",
|
||||
"added"
|
||||
]
|
||||
],
|
||||
"field_type": "NonPaginatableList",
|
||||
"field_subtype": "AccountCreationErrorDetailsField",
|
||||
"field_structuretype": null,
|
||||
"is_optional": true,
|
||||
"is_nullable": false
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -0,0 +1,138 @@
|
|||
interactions:
|
||||
- request:
|
||||
body: null
|
||||
headers:
|
||||
Accept:
|
||||
- '*/*'
|
||||
Accept-Encoding:
|
||||
- gzip, deflate, br
|
||||
Authorization:
|
||||
- DUMMY
|
||||
Connection:
|
||||
- keep-alive
|
||||
User-Agent:
|
||||
- mastodonpy
|
||||
method: GET
|
||||
uri: https://mastodon.social/api/v1/statuses/115044073088181107
|
||||
response:
|
||||
body:
|
||||
string: '{"id": "115044073088181107", "created_at": "2025-08-17T12:20:44.088Z",
|
||||
"in_reply_to_id": "115044053131672379", "in_reply_to_account_id": "109446733188999785",
|
||||
"sensitive": false, "spoiler_text": "", "visibility": "public", "language":
|
||||
"en", "uri": "https://bsky.brid.gy/convert/ap/at://did:plc:5syfqzormjkutgo5hi2u2gpr/app.bsky.feed.post/3lwlunj3oqs22",
|
||||
"url": "https://bsky.brid.gy/r/https://bsky.app/profile/did:plc:5syfqzormjkutgo5hi2u2gpr/post/3lwlunj3oqs22",
|
||||
"replies_count": 0, "reblogs_count": 0, "favourites_count": 0, "edited_at":
|
||||
null, "favourited": false, "reblogged": false, "muted": false, "bookmarked":
|
||||
false, "content": "<p>actual reply that quotes a post that quotes a post <a
|
||||
href=\"https://bsky.app/profile/h4lcy.bsky.social/post/3lwlumdwf522i\" rel=\"nofollow
|
||||
noopener\" target=\"_blank\">bsky.app/profile/h4lc...</a><span class=\"quote-inline\"><br><br>RE:
|
||||
<a href=\"https://bsky.app/profile/did:plc:5syfqzormjkutgo5hi2u2gpr/post/3lwlumdwf522i\"
|
||||
rel=\"nofollow noopener\" target=\"_blank\">https://bsky.app/profile/did:plc:5syfqzormjkutgo5hi2u2gpr/post/3lwlumdwf522i</a></span></p>",
|
||||
"filtered": [], "reblog": null, "account": {"id": "115043949422165680", "username":
|
||||
"h4lcy.bsky.social", "acct": "h4lcy.bsky.social@bsky.brid.gy", "display_name":
|
||||
"", "locked": false, "bot": false, "discoverable": true, "indexable": true,
|
||||
"group": false, "created_at": "2025-07-09T00:00:00.000Z", "note": "\ud83c\udf09
|
||||
<a href=\"https://fed.brid.gy/bsky/h4lcy.bsky.social\" rel=\"nofollow noopener\"
|
||||
target=\"_blank\">bridged</a> from <a href=\"https://bsky.app/profile/h4lcy.bsky.social\"
|
||||
rel=\"nofollow noopener\" target=\"_blank\">h4lcy.bsky.social</a> on Bluesky
|
||||
by <a href=\"https://fed.brid.gy/\" rel=\"nofollow noopener\" target=\"_blank\">Bridgy
|
||||
Fed</a>", "url": "https://bsky.brid.gy/r/https://bsky.app/profile/h4lcy.bsky.social",
|
||||
"uri": "https://bsky.brid.gy/ap/did:plc:5syfqzormjkutgo5hi2u2gpr", "avatar":
|
||||
"https://files.mastodon.social/cache/accounts/avatars/115/043/949/422/165/680/original/3e1dd77d9101ba91.png",
|
||||
"avatar_static": "https://files.mastodon.social/cache/accounts/avatars/115/043/949/422/165/680/original/3e1dd77d9101ba91.png",
|
||||
"header": "https://files.mastodon.social/cache/accounts/headers/115/043/949/422/165/680/original/5e90a3286a31ed8d.png",
|
||||
"header_static": "https://files.mastodon.social/cache/accounts/headers/115/043/949/422/165/680/original/5e90a3286a31ed8d.png",
|
||||
"followers_count": 0, "following_count": 0, "statuses_count": 3, "last_status_at":
|
||||
"2025-08-17", "hide_collections": false, "emojis": [], "fields": [{"name":
|
||||
"Web site", "value": "<a rel=\"nofollow noopener\" href=\"https://bsky.app/profile/h4lcy.bsky.social\"
|
||||
target=\"_blank\"><span class=\"invisible\">https://</span>bsky.app/profile/h4lcy.bsky.social</a>",
|
||||
"verified_at": null}]}, "media_attachments": [], "mentions": [], "tags": [],
|
||||
"emojis": [], "quote": {"state": "accepted", "quoted_status": {"id": "115044070560414080",
|
||||
"created_at": "2025-08-17T12:20:05.117Z", "in_reply_to_id": "115044053131672379",
|
||||
"in_reply_to_account_id": "109446733188999785", "sensitive": false, "spoiler_text":
|
||||
"", "visibility": "public", "language": "en", "uri": "https://bsky.brid.gy/convert/ap/at://did:plc:5syfqzormjkutgo5hi2u2gpr/app.bsky.feed.post/3lwlumdwf522i",
|
||||
"url": "https://bsky.brid.gy/r/https://bsky.app/profile/did:plc:5syfqzormjkutgo5hi2u2gpr/post/3lwlumdwf522i",
|
||||
"replies_count": 0, "reblogs_count": 0, "favourites_count": 0, "edited_at":
|
||||
null, "favourited": false, "reblogged": false, "muted": false, "bookmarked":
|
||||
false, "content": "<p>actual reply that quotes a bsky post <a href=\"https://bsky.app/profile/h4lcy.bsky.social/post/3lwlug73kn22i\"
|
||||
rel=\"nofollow noopener\" target=\"_blank\">bsky.app/profile/h4lc...</a><span
|
||||
class=\"quote-inline\"><br><br>RE: <a href=\"https://bsky.app/profile/did:plc:5syfqzormjkutgo5hi2u2gpr/post/3lwlug73kn22i\"
|
||||
rel=\"nofollow noopener\" target=\"_blank\">https://bsky.app/profile/did:plc:5syfqzormjkutgo5hi2u2gpr/post/3lwlug73kn22i</a></span></p>",
|
||||
"filtered": [], "reblog": null, "account": {"id": "115043949422165680", "username":
|
||||
"h4lcy.bsky.social", "acct": "h4lcy.bsky.social@bsky.brid.gy", "display_name":
|
||||
"", "locked": false, "bot": false, "discoverable": true, "indexable": true,
|
||||
"group": false, "created_at": "2025-07-09T00:00:00.000Z", "note": "\ud83c\udf09
|
||||
<a href=\"https://fed.brid.gy/bsky/h4lcy.bsky.social\" rel=\"nofollow noopener\"
|
||||
target=\"_blank\">bridged</a> from <a href=\"https://bsky.app/profile/h4lcy.bsky.social\"
|
||||
rel=\"nofollow noopener\" target=\"_blank\">h4lcy.bsky.social</a> on Bluesky
|
||||
by <a href=\"https://fed.brid.gy/\" rel=\"nofollow noopener\" target=\"_blank\">Bridgy
|
||||
Fed</a>", "url": "https://bsky.brid.gy/r/https://bsky.app/profile/h4lcy.bsky.social",
|
||||
"uri": "https://bsky.brid.gy/ap/did:plc:5syfqzormjkutgo5hi2u2gpr", "avatar":
|
||||
"https://files.mastodon.social/cache/accounts/avatars/115/043/949/422/165/680/original/3e1dd77d9101ba91.png",
|
||||
"avatar_static": "https://files.mastodon.social/cache/accounts/avatars/115/043/949/422/165/680/original/3e1dd77d9101ba91.png",
|
||||
"header": "https://files.mastodon.social/cache/accounts/headers/115/043/949/422/165/680/original/5e90a3286a31ed8d.png",
|
||||
"header_static": "https://files.mastodon.social/cache/accounts/headers/115/043/949/422/165/680/original/5e90a3286a31ed8d.png",
|
||||
"followers_count": 0, "following_count": 0, "statuses_count": 3, "last_status_at":
|
||||
"2025-08-17", "hide_collections": false, "emojis": [], "fields": [{"name":
|
||||
"Web site", "value": "<a rel=\"nofollow noopener\" href=\"https://bsky.app/profile/h4lcy.bsky.social\"
|
||||
target=\"_blank\"><span class=\"invisible\">https://</span>bsky.app/profile/h4lcy.bsky.social</a>",
|
||||
"verified_at": null}]}, "media_attachments": [], "mentions": [], "tags": [],
|
||||
"emojis": [], "quote": {"state": "accepted", "quoted_status_id": "115044056977193502"},
|
||||
"card": null, "poll": null}}, "card": null, "poll": null}'
|
||||
headers:
|
||||
Connection:
|
||||
- keep-alive
|
||||
Date:
|
||||
- Sun, 17 Aug 2025 14:16:04 GMT
|
||||
Strict-Transport-Security:
|
||||
- max-age=31557600
|
||||
Vary:
|
||||
- Authorization, Origin, Accept-Encoding
|
||||
X-Cache:
|
||||
- MISS, MISS, MISS
|
||||
X-Cache-Hits:
|
||||
- 0, 0, 0
|
||||
X-Served-By:
|
||||
- cache-fra-eddf8230164-FRA, cache-fra-eddf8230123-FRA, cache-hel1410027-HEL
|
||||
X-Timer:
|
||||
- S1755440164.907276,VS0,VE244
|
||||
accept-ranges:
|
||||
- none
|
||||
alt-svc:
|
||||
- h3=":443";ma=86400,h3-29=":443";ma=86400,h3-27=":443";ma=86400
|
||||
cache-control:
|
||||
- private, no-store
|
||||
content-length:
|
||||
- '6039'
|
||||
content-security-policy:
|
||||
- default-src 'none'; frame-ancestors 'none'; form-action 'none'
|
||||
content-type:
|
||||
- application/json; charset=utf-8
|
||||
etag:
|
||||
- W/"d4ceadbc6c817585858affce5de7be25"
|
||||
referrer-policy:
|
||||
- same-origin
|
||||
transfer-encoding:
|
||||
- chunked
|
||||
via:
|
||||
- 1.1 varnish, 1.1 varnish, 1.1 varnish
|
||||
x-content-type-options:
|
||||
- nosniff
|
||||
x-frame-options:
|
||||
- DENY
|
||||
x-ratelimit-limit:
|
||||
- '300'
|
||||
x-ratelimit-remaining:
|
||||
- '299'
|
||||
x-ratelimit-reset:
|
||||
- '2025-08-17T14:20:00.985158Z'
|
||||
x-request-id:
|
||||
- f963a45420343c7de759abae50c08fbc
|
||||
x-runtime:
|
||||
- '0.154823'
|
||||
x-xss-protection:
|
||||
- '0'
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
version: 1
|
Plik diff jest za duży
Load Diff
|
@ -0,0 +1,138 @@
|
|||
interactions:
|
||||
- request:
|
||||
body: null
|
||||
headers:
|
||||
Accept:
|
||||
- '*/*'
|
||||
Accept-Encoding:
|
||||
- gzip, deflate, br
|
||||
Authorization:
|
||||
- DUMMY
|
||||
Connection:
|
||||
- keep-alive
|
||||
User-Agent:
|
||||
- mastodonpy
|
||||
method: GET
|
||||
uri: https://mastodon.social/api/v1/statuses/115044073088181107
|
||||
response:
|
||||
body:
|
||||
string: '{"id": "115044073088181107", "created_at": "2025-08-17T12:20:44.088Z",
|
||||
"in_reply_to_id": "115044053131672379", "in_reply_to_account_id": "109446733188999785",
|
||||
"sensitive": false, "spoiler_text": "", "visibility": "public", "language":
|
||||
"en", "uri": "https://bsky.brid.gy/convert/ap/at://did:plc:5syfqzormjkutgo5hi2u2gpr/app.bsky.feed.post/3lwlunj3oqs22",
|
||||
"url": "https://bsky.brid.gy/r/https://bsky.app/profile/did:plc:5syfqzormjkutgo5hi2u2gpr/post/3lwlunj3oqs22",
|
||||
"replies_count": 0, "reblogs_count": 0, "favourites_count": 0, "edited_at":
|
||||
null, "favourited": false, "reblogged": false, "muted": false, "bookmarked":
|
||||
false, "content": "<p>actual reply that quotes a post that quotes a post <a
|
||||
href=\"https://bsky.app/profile/h4lcy.bsky.social/post/3lwlumdwf522i\" rel=\"nofollow
|
||||
noopener\" target=\"_blank\">bsky.app/profile/h4lc...</a><span class=\"quote-inline\"><br><br>RE:
|
||||
<a href=\"https://bsky.app/profile/did:plc:5syfqzormjkutgo5hi2u2gpr/post/3lwlumdwf522i\"
|
||||
rel=\"nofollow noopener\" target=\"_blank\">https://bsky.app/profile/did:plc:5syfqzormjkutgo5hi2u2gpr/post/3lwlumdwf522i</a></span></p>",
|
||||
"filtered": [], "reblog": null, "account": {"id": "115043949422165680", "username":
|
||||
"h4lcy.bsky.social", "acct": "h4lcy.bsky.social@bsky.brid.gy", "display_name":
|
||||
"", "locked": false, "bot": false, "discoverable": true, "indexable": true,
|
||||
"group": false, "created_at": "2025-07-09T00:00:00.000Z", "note": "\ud83c\udf09
|
||||
<a href=\"https://fed.brid.gy/bsky/h4lcy.bsky.social\" rel=\"nofollow noopener\"
|
||||
target=\"_blank\">bridged</a> from <a href=\"https://bsky.app/profile/h4lcy.bsky.social\"
|
||||
rel=\"nofollow noopener\" target=\"_blank\">h4lcy.bsky.social</a> on Bluesky
|
||||
by <a href=\"https://fed.brid.gy/\" rel=\"nofollow noopener\" target=\"_blank\">Bridgy
|
||||
Fed</a>", "url": "https://bsky.brid.gy/r/https://bsky.app/profile/h4lcy.bsky.social",
|
||||
"uri": "https://bsky.brid.gy/ap/did:plc:5syfqzormjkutgo5hi2u2gpr", "avatar":
|
||||
"https://files.mastodon.social/cache/accounts/avatars/115/043/949/422/165/680/original/3e1dd77d9101ba91.png",
|
||||
"avatar_static": "https://files.mastodon.social/cache/accounts/avatars/115/043/949/422/165/680/original/3e1dd77d9101ba91.png",
|
||||
"header": "https://files.mastodon.social/cache/accounts/headers/115/043/949/422/165/680/original/5e90a3286a31ed8d.png",
|
||||
"header_static": "https://files.mastodon.social/cache/accounts/headers/115/043/949/422/165/680/original/5e90a3286a31ed8d.png",
|
||||
"followers_count": 0, "following_count": 0, "statuses_count": 3, "last_status_at":
|
||||
"2025-08-17", "hide_collections": false, "emojis": [], "fields": [{"name":
|
||||
"Web site", "value": "<a rel=\"nofollow noopener\" href=\"https://bsky.app/profile/h4lcy.bsky.social\"
|
||||
target=\"_blank\"><span class=\"invisible\">https://</span>bsky.app/profile/h4lcy.bsky.social</a>",
|
||||
"verified_at": null}]}, "media_attachments": [], "mentions": [], "tags": [],
|
||||
"emojis": [], "quote": {"state": "accepted", "quoted_status": {"id": "115044070560414080",
|
||||
"created_at": "2025-08-17T12:20:05.117Z", "in_reply_to_id": "115044053131672379",
|
||||
"in_reply_to_account_id": "109446733188999785", "sensitive": false, "spoiler_text":
|
||||
"", "visibility": "public", "language": "en", "uri": "https://bsky.brid.gy/convert/ap/at://did:plc:5syfqzormjkutgo5hi2u2gpr/app.bsky.feed.post/3lwlumdwf522i",
|
||||
"url": "https://bsky.brid.gy/r/https://bsky.app/profile/did:plc:5syfqzormjkutgo5hi2u2gpr/post/3lwlumdwf522i",
|
||||
"replies_count": 0, "reblogs_count": 0, "favourites_count": 0, "edited_at":
|
||||
null, "favourited": false, "reblogged": false, "muted": false, "bookmarked":
|
||||
false, "content": "<p>actual reply that quotes a bsky post <a href=\"https://bsky.app/profile/h4lcy.bsky.social/post/3lwlug73kn22i\"
|
||||
rel=\"nofollow noopener\" target=\"_blank\">bsky.app/profile/h4lc...</a><span
|
||||
class=\"quote-inline\"><br><br>RE: <a href=\"https://bsky.app/profile/did:plc:5syfqzormjkutgo5hi2u2gpr/post/3lwlug73kn22i\"
|
||||
rel=\"nofollow noopener\" target=\"_blank\">https://bsky.app/profile/did:plc:5syfqzormjkutgo5hi2u2gpr/post/3lwlug73kn22i</a></span></p>",
|
||||
"filtered": [], "reblog": null, "account": {"id": "115043949422165680", "username":
|
||||
"h4lcy.bsky.social", "acct": "h4lcy.bsky.social@bsky.brid.gy", "display_name":
|
||||
"", "locked": false, "bot": false, "discoverable": true, "indexable": true,
|
||||
"group": false, "created_at": "2025-07-09T00:00:00.000Z", "note": "\ud83c\udf09
|
||||
<a href=\"https://fed.brid.gy/bsky/h4lcy.bsky.social\" rel=\"nofollow noopener\"
|
||||
target=\"_blank\">bridged</a> from <a href=\"https://bsky.app/profile/h4lcy.bsky.social\"
|
||||
rel=\"nofollow noopener\" target=\"_blank\">h4lcy.bsky.social</a> on Bluesky
|
||||
by <a href=\"https://fed.brid.gy/\" rel=\"nofollow noopener\" target=\"_blank\">Bridgy
|
||||
Fed</a>", "url": "https://bsky.brid.gy/r/https://bsky.app/profile/h4lcy.bsky.social",
|
||||
"uri": "https://bsky.brid.gy/ap/did:plc:5syfqzormjkutgo5hi2u2gpr", "avatar":
|
||||
"https://files.mastodon.social/cache/accounts/avatars/115/043/949/422/165/680/original/3e1dd77d9101ba91.png",
|
||||
"avatar_static": "https://files.mastodon.social/cache/accounts/avatars/115/043/949/422/165/680/original/3e1dd77d9101ba91.png",
|
||||
"header": "https://files.mastodon.social/cache/accounts/headers/115/043/949/422/165/680/original/5e90a3286a31ed8d.png",
|
||||
"header_static": "https://files.mastodon.social/cache/accounts/headers/115/043/949/422/165/680/original/5e90a3286a31ed8d.png",
|
||||
"followers_count": 0, "following_count": 0, "statuses_count": 3, "last_status_at":
|
||||
"2025-08-17", "hide_collections": false, "emojis": [], "fields": [{"name":
|
||||
"Web site", "value": "<a rel=\"nofollow noopener\" href=\"https://bsky.app/profile/h4lcy.bsky.social\"
|
||||
target=\"_blank\"><span class=\"invisible\">https://</span>bsky.app/profile/h4lcy.bsky.social</a>",
|
||||
"verified_at": null}]}, "media_attachments": [], "mentions": [], "tags": [],
|
||||
"emojis": [], "quote": {"state": "accepted", "quoted_status_id": "115044056977193502"},
|
||||
"card": null, "poll": null}}, "card": null, "poll": null}'
|
||||
headers:
|
||||
Connection:
|
||||
- keep-alive
|
||||
Date:
|
||||
- Sun, 17 Aug 2025 14:16:04 GMT
|
||||
Strict-Transport-Security:
|
||||
- max-age=31557600
|
||||
Vary:
|
||||
- Authorization, Origin, Accept-Encoding
|
||||
X-Cache:
|
||||
- MISS, MISS, MISS
|
||||
X-Cache-Hits:
|
||||
- 0, 0, 0
|
||||
X-Served-By:
|
||||
- cache-fra-eddf8230051-FRA, cache-fra-eddf8230021-FRA, cache-hel1410027-HEL
|
||||
X-Timer:
|
||||
- S1755440164.400819,VS0,VE315
|
||||
accept-ranges:
|
||||
- none
|
||||
alt-svc:
|
||||
- h3=":443";ma=86400,h3-29=":443";ma=86400,h3-27=":443";ma=86400
|
||||
cache-control:
|
||||
- private, no-store
|
||||
content-length:
|
||||
- '6039'
|
||||
content-security-policy:
|
||||
- default-src 'none'; frame-ancestors 'none'; form-action 'none'
|
||||
content-type:
|
||||
- application/json; charset=utf-8
|
||||
etag:
|
||||
- W/"d4ceadbc6c817585858affce5de7be25"
|
||||
referrer-policy:
|
||||
- same-origin
|
||||
transfer-encoding:
|
||||
- chunked
|
||||
via:
|
||||
- 1.1 varnish, 1.1 varnish, 1.1 varnish
|
||||
x-content-type-options:
|
||||
- nosniff
|
||||
x-frame-options:
|
||||
- DENY
|
||||
x-ratelimit-limit:
|
||||
- '300'
|
||||
x-ratelimit-remaining:
|
||||
- '298'
|
||||
x-ratelimit-reset:
|
||||
- '2025-08-17T14:20:00.586582Z'
|
||||
x-request-id:
|
||||
- cbbae620acf1bfcb1df094c657eeeaee
|
||||
x-runtime:
|
||||
- '0.127146'
|
||||
x-xss-protection:
|
||||
- '0'
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
version: 1
|
|
@ -126,6 +126,40 @@ def test_entity_status(mastodon_base, mastodon_admin):
|
|||
if sys.version_info >= (3, 9):
|
||||
assert real_issubclass(type(result), Status), str(type(result)) + ' is not a subclass of Status after to_json/from_json (additional function)'
|
||||
|
||||
@pytest.mark.vcr(
|
||||
filter_query_parameters=[('access_token', 'DUMMY'), ('client_id', 'DUMMY'), ('client_secret', 'DUMMY')],
|
||||
filter_post_data_parameters=[('access_token', 'DUMMY'), ('client_id', 'DUMMY'), ('client_secret', 'DUMMY')],
|
||||
filter_headers=[('Authorization', 'DUMMY')],
|
||||
before_record_request=vcr_filter,
|
||||
before_record_response=token_scrubber,
|
||||
match_on=['method', 'uri'],
|
||||
cassette_library_dir='tests/cassettes_entity_tests'
|
||||
)
|
||||
def test_entity_quote(mastodon_base, mastodon_admin):
|
||||
mastodon = mastodon_base
|
||||
result = mastodon.status(115044073088181107).quote
|
||||
assert real_issubclass(type(result), Quote), str(type(result)) + ' is not a subclass of Quote'
|
||||
result = Entity.from_json(result.to_json())
|
||||
if sys.version_info >= (3, 9):
|
||||
assert real_issubclass(type(result), Quote), str(type(result)) + ' is not a subclass of Quote after to_json/from_json'
|
||||
|
||||
@pytest.mark.vcr(
|
||||
filter_query_parameters=[('access_token', 'DUMMY'), ('client_id', 'DUMMY'), ('client_secret', 'DUMMY')],
|
||||
filter_post_data_parameters=[('access_token', 'DUMMY'), ('client_id', 'DUMMY'), ('client_secret', 'DUMMY')],
|
||||
filter_headers=[('Authorization', 'DUMMY')],
|
||||
before_record_request=vcr_filter,
|
||||
before_record_response=token_scrubber,
|
||||
match_on=['method', 'uri'],
|
||||
cassette_library_dir='tests/cassettes_entity_tests'
|
||||
)
|
||||
def test_entity_shallowquote(mastodon_base, mastodon_admin):
|
||||
mastodon = mastodon_base
|
||||
result = mastodon.status(115044073088181107).quote.quoted_status.quote
|
||||
assert real_issubclass(type(result), ShallowQuote), str(type(result)) + ' is not a subclass of ShallowQuote'
|
||||
result = Entity.from_json(result.to_json())
|
||||
if sys.version_info >= (3, 9):
|
||||
assert real_issubclass(type(result), ShallowQuote), str(type(result)) + ' is not a subclass of ShallowQuote after to_json/from_json'
|
||||
|
||||
@pytest.mark.vcr(
|
||||
filter_query_parameters=[('access_token', 'DUMMY'), ('client_id', 'DUMMY'), ('client_secret', 'DUMMY')],
|
||||
filter_post_data_parameters=[('access_token', 'DUMMY'), ('client_id', 'DUMMY'), ('client_secret', 'DUMMY')],
|
||||
|
@ -865,6 +899,23 @@ def test_entity_instanceusageusers(mastodon_base, mastodon_admin):
|
|||
if sys.version_info >= (3, 9):
|
||||
assert real_issubclass(type(result), InstanceUsageUsers), str(type(result)) + ' is not a subclass of InstanceUsageUsers after to_json/from_json'
|
||||
|
||||
@pytest.mark.vcr(
|
||||
filter_query_parameters=[('access_token', 'DUMMY'), ('client_id', 'DUMMY'), ('client_secret', 'DUMMY')],
|
||||
filter_post_data_parameters=[('access_token', 'DUMMY'), ('client_id', 'DUMMY'), ('client_secret', 'DUMMY')],
|
||||
filter_headers=[('Authorization', 'DUMMY')],
|
||||
before_record_request=vcr_filter,
|
||||
before_record_response=token_scrubber,
|
||||
match_on=['method', 'uri'],
|
||||
cassette_library_dir='tests/cassettes_entity_tests'
|
||||
)
|
||||
def test_entity_ruletranslation(mastodon_base, mastodon_admin):
|
||||
mastodon = mastodon_base
|
||||
result = mastodon.instance().rules[0].translations['de']
|
||||
assert real_issubclass(type(result), RuleTranslation), str(type(result)) + ' is not a subclass of RuleTranslation'
|
||||
result = Entity.from_json(result.to_json())
|
||||
if sys.version_info >= (3, 9):
|
||||
assert real_issubclass(type(result), RuleTranslation), str(type(result)) + ' is not a subclass of RuleTranslation after to_json/from_json'
|
||||
|
||||
@pytest.mark.vcr(
|
||||
filter_query_parameters=[('access_token', 'DUMMY'), ('client_id', 'DUMMY'), ('client_secret', 'DUMMY')],
|
||||
filter_post_data_parameters=[('access_token', 'DUMMY'), ('client_id', 'DUMMY'), ('client_secret', 'DUMMY')],
|
||||
|
|
Ładowanie…
Reference in New Issue