aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhalcy <[email protected]>2022-11-06 14:24:20 +0200
committerhalcy <[email protected]>2022-11-06 14:24:20 +0200
commit5fe162e5434632814fc61bd318a0887332d10579 (patch)
tree0f13aad1f0078904f8b19b476fb77b45325659d0 /mastodon
parent9d3dd85af3b46f77ee2c83995618b96aa66c4794 (diff)
downloadmastodon.py-5fe162e5434632814fc61bd318a0887332d10579.tar.gz
Fix some things that may have broken in PRs
Diffstat (limited to 'mastodon')
-rw-r--r--mastodon/Mastodon.py21
1 files changed, 18 insertions, 3 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index 16f2556..3d154bb 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -1000,18 +1000,27 @@ class Mastodon:
1000 # Reading data: Notifications 1000 # Reading data: Notifications
1001 ### 1001 ###
1002 @api_version("1.0.0", "2.9.0", __DICT_VERSION_NOTIFICATION) 1002 @api_version("1.0.0", "2.9.0", __DICT_VERSION_NOTIFICATION)
1003 def notifications(self, id=None, account_id=None, max_id=None, min_id=None, since_id=None, limit=None, exclude_types=None): 1003 def notifications(self, id=None, account_id=None, max_id=None, min_id=None, since_id=None, limit=None, exclude_types=None, mentions_only=None):
1004 """ 1004 """
1005 Fetch notifications (mentions, favourites, reblogs, follows) for the logged-in 1005 Fetch notifications (mentions, favourites, reblogs, follows) for the logged-in
1006 user. Pass `account_id` to get only notifications originating from the given account. 1006 user. Pass `account_id` to get only notifications originating from the given account.
1007 1007
1008 Parameter `exclude_types` is an array of the following `follow`, `favourite`, `reblog`, 1008 Parameter `exclude_types` is an array of the following `follow`, `favourite`, `reblog`,
1009 `mention`, `poll`, `follow_request` 1009 `mention`, `poll`, `follow_request`. Specifying `mentions_only` is a deprecated way to
1010 set `exclude_types` to all but mentions.
1010 1011
1011 Can be passed an `id` to fetch a single notification. 1012 Can be passed an `id` to fetch a single notification.
1012 1013
1013 Returns a list of `notification dicts`_. 1014 Returns a list of `notification dicts`_.
1014 """ 1015 """
1016 if not mentions_only is None:
1017 if not exclude_types is None:
1018 if mentions_only:
1019 exclude_types = ["follow", "favourite", "reblog", "poll", "follow_request"]
1020 else:
1021 raise MastodonIllegalArgumentError('Cannot specify exclude_types when mentions_only is present')
1022 del mentions_only
1023
1015 if max_id != None: 1024 if max_id != None:
1016 max_id = self.__unpack_id(max_id) 1025 max_id = self.__unpack_id(max_id)
1017 1026
@@ -3410,9 +3419,15 @@ class Mastodon:
3410 if 'X-RateLimit-Remaining' in response_object.headers and do_ratelimiting: 3419 if 'X-RateLimit-Remaining' in response_object.headers and do_ratelimiting:
3411 self.ratelimit_remaining = int(response_object.headers['X-RateLimit-Remaining']) 3420 self.ratelimit_remaining = int(response_object.headers['X-RateLimit-Remaining'])
3412 self.ratelimit_limit = int(response_object.headers['X-RateLimit-Limit']) 3421 self.ratelimit_limit = int(response_object.headers['X-RateLimit-Limit'])
3422
3423 # For gotosocial, we need an int representation, but for non-ints this would crash
3424 try:
3425 ratelimit_intrep = str(int(response_object.headers['X-RateLimit-Reset']))
3426 except:
3427 ratelimit_intrep = None
3413 3428
3414 try: 3429 try:
3415 if str(int(response_object.headers['X-RateLimit-Reset'])) == response_object.headers['X-RateLimit-Reset']: 3430 if not ratelimit_intrep is None and ratelimit_intrep == response_object.headers['X-RateLimit-Reset']:
3416 self.ratelimit_reset = int(response_object.headers['X-RateLimit-Reset']) 3431 self.ratelimit_reset = int(response_object.headers['X-RateLimit-Reset'])
3417 else: 3432 else:
3418 ratelimit_reset_datetime = dateutil.parser.parse(response_object.headers['X-RateLimit-Reset']) 3433 ratelimit_reset_datetime = dateutil.parser.parse(response_object.headers['X-RateLimit-Reset'])
Powered by cgit v1.2.3 (git 2.41.0)