aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhalcy <halcy@ARARAGI-KUN>2022-12-01 21:44:57 +0200
committerhalcy <halcy@ARARAGI-KUN>2022-12-01 21:44:57 +0200
commit405e01bef9461b1f53994425318ac27f293f46cb (patch)
tree3d819e9268ccbfca7dc1505fdeaf4a536487b34f /mastodon
parentd2f76239e1bf631cea0d03e1f48b8e0a60909467 (diff)
downloadmastodon.py-405e01bef9461b1f53994425318ac27f293f46cb.tar.gz
Minor fixes, document some return values
Diffstat (limited to 'mastodon')
-rw-r--r--mastodon/internals.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/mastodon/internals.py b/mastodon/internals.py
index aa82553..758a1d4 100644
--- a/mastodon/internals.py
+++ b/mastodon/internals.py
@@ -62,7 +62,7 @@ class Mastodon():
62 Parse dates in certain known json fields, if possible. 62 Parse dates in certain known json fields, if possible.
63 """ 63 """
64 known_date_fields = ["created_at", "week", "day", "expires_at", "scheduled_at", 64 known_date_fields = ["created_at", "week", "day", "expires_at", "scheduled_at",
65 "updated_at", "last_status_at", "starts_at", "ends_at", "published_at", "edited_at"] 65 "updated_at", "last_status_at", "starts_at", "ends_at", "published_at", "edited_at", "date", "period"]
66 mark_delete = [] 66 mark_delete = []
67 for k, v in json_object.items(): 67 for k, v in json_object.items():
68 if k in known_date_fields: 68 if k in known_date_fields:
@@ -85,7 +85,7 @@ class Mastodon():
85 """ 85 """
86 Parse 'True' / 'False' strings in certain known fields 86 Parse 'True' / 'False' strings in certain known fields
87 """ 87 """
88 for key in ('follow', 'favourite', 'reblog', 'mention'): 88 for key in ('follow', 'favourite', 'reblog', 'mention', 'confirmed', 'suspended', 'silenced', 'disabled', 'approved', 'all_day'):
89 if (key in json_object and isinstance(json_object[key], six.text_type)): 89 if (key in json_object and isinstance(json_object[key], six.text_type)):
90 if json_object[key].lower() == 'true': 90 if json_object[key].lower() == 'true':
91 json_object[key] = True 91 json_object[key] = True
@@ -98,7 +98,8 @@ class Mastodon():
98 """ 98 """
99 Converts json string numerals to native python bignums. 99 Converts json string numerals to native python bignums.
100 """ 100 """
101 for key in ('id', 'week', 'in_reply_to_id', 'in_reply_to_account_id', 'logins', 'registrations', 'statuses', 'day', 'last_read_id'): 101 for key in ('id', 'week', 'in_reply_to_id', 'in_reply_to_account_id', 'logins', 'registrations', 'statuses',
102 'day', 'last_read_id', 'value', 'frequency', 'rate', 'invited_by_account_id', 'count'):
102 if (key in json_object and isinstance(json_object[key], six.text_type)): 103 if (key in json_object and isinstance(json_object[key], six.text_type)):
103 try: 104 try:
104 json_object[key] = int(json_object[key]) 105 json_object[key] = int(json_object[key])
Powered by cgit v1.2.3 (git 2.41.0)