aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenz Diener <[email protected]>2019-04-27 23:20:45 +0200
committerLorenz Diener <[email protected]>2019-04-27 23:20:45 +0200
commit5340087325242a7a43c97f8218aeb8f2b5b44ef0 (patch)
tree5734759d301763a145ef251bd30ff34e8ffa25a0 /mastodon/Mastodon.py
parentdc6c80bad74dd22ebe1d75869e99bc3f735380b5 (diff)
downloadmastodon.py-5340087325242a7a43c97f8218aeb8f2b5b44ef0.tar.gz
Add min_id parameter to a lot of functions
Diffstat (limited to 'mastodon/Mastodon.py')
-rw-r--r--mastodon/Mastodon.py117
1 files changed, 78 insertions, 39 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index 0c9d339..16617e3 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -500,8 +500,8 @@ class Mastodon:
500 ### 500 ###
501 # Reading data: Timelines 501 # Reading data: Timelines
502 ## 502 ##
503 @api_version("1.0.0", "2.0.0", __DICT_VERSION_STATUS) 503 @api_version("1.0.0", "2.6.0", __DICT_VERSION_STATUS)
504 def timeline(self, timeline="home", max_id=None, since_id=None, limit=None): 504 def timeline(self, timeline="home", max_id=None, min_id=None, since_id=None, limit=None):
505 """ 505 """
506 Fetch statuses, most recent ones first. `timeline` can be 'home', 'local', 'public', 506 Fetch statuses, most recent ones first. `timeline` can be 'home', 'local', 'public',
507 'tag/hashtag' or 'list/id'. See the following functions documentation for what those do. 507 'tag/hashtag' or 'list/id'. See the following functions documentation for what those do.
@@ -516,9 +516,12 @@ class Mastodon:
516 if max_id != None: 516 if max_id != None:
517 max_id = self.__unpack_id(max_id) 517 max_id = self.__unpack_id(max_id)
518 518
519 if min_id != None:
520 min_id = self.__unpack_id(min_id)
521
519 if since_id != None: 522 if since_id != None:
520 since_id = self.__unpack_id(since_id) 523 since_id = self.__unpack_id(since_id)
521 524
522 params_initial = locals() 525 params_initial = locals()
523 526
524 if timeline == "local": 527 if timeline == "local":
@@ -529,28 +532,28 @@ class Mastodon:
529 url = '/api/v1/timelines/{0}'.format(timeline) 532 url = '/api/v1/timelines/{0}'.format(timeline)
530 return self.__api_request('GET', url, params) 533 return self.__api_request('GET', url, params)
531 534
532 @api_version("1.0.0", "2.0.0", __DICT_VERSION_STATUS) 535 @api_version("1.0.0", "2.6.0", __DICT_VERSION_STATUS)
533 def timeline_home(self, max_id=None, since_id=None, limit=None): 536 def timeline_home(self, max_id=None, min_id=None, since_id=None, limit=None):
534 """ 537 """
535 Fetch the logged-in users home timeline (i.e. followed users and self). 538 Fetch the logged-in users home timeline (i.e. followed users and self).
536 539
537 Returns a list of `toot dicts`_. 540 Returns a list of `toot dicts`_.
538 """ 541 """
539 return self.timeline('home', max_id=max_id, since_id=since_id, 542 return self.timeline('home', max_id=max_id, min_id=min_id,
540 limit=limit) 543 since_id=since_id, limit=limit)
541 544
542 @api_version("1.0.0", "2.0.0", __DICT_VERSION_STATUS) 545 @api_version("1.0.0", "2.6.0", __DICT_VERSION_STATUS)
543 def timeline_local(self, max_id=None, since_id=None, limit=None): 546 def timeline_local(self, max_id=None, min_id=None, since_id=None, limit=None):
544 """ 547 """
545 Fetches the local / instance-wide timeline, not including replies. 548 Fetches the local / instance-wide timeline, not including replies.
546 549
547 Returns a list of `toot dicts`_. 550 Returns a list of `toot dicts`_.
548 """ 551 """
549 return self.timeline('local', max_id=max_id, since_id=since_id, 552 return self.timeline('local', max_id=max_id, min_id=min_id,
550 limit=limit) 553 since_id=since_id, limit=limit)
551 554
552 @api_version("1.0.0", "2.3.0", __DICT_VERSION_STATUS) 555 @api_version("1.0.0", "2.6.0", __DICT_VERSION_STATUS)
553 def timeline_public(self, max_id=None, since_id=None, limit=None, only_media=False): 556 def timeline_public(self, max_id=None, min_id=None, since_id=None, limit=None, only_media=False):
554 """ 557 """
555 Fetches the public / visible-network timeline, not including replies. 558 Fetches the public / visible-network timeline, not including replies.
556 559
@@ -560,10 +563,13 @@ class Mastodon:
560 """ 563 """
561 if max_id != None: 564 if max_id != None:
562 max_id = self.__unpack_id(max_id) 565 max_id = self.__unpack_id(max_id)
566
567 if min_id != None:
568 min_id = self.__unpack_id(min_id)
563 569
564 if since_id != None: 570 if since_id != None:
565 since_id = self.__unpack_id(since_id) 571 since_id = self.__unpack_id(since_id)
566 572
567 params_initial = locals() 573 params_initial = locals()
568 574
569 if only_media == False: 575 if only_media == False:
@@ -574,8 +580,8 @@ class Mastodon:
574 580
575 return self.__api_request('GET', url, params) 581 return self.__api_request('GET', url, params)
576 582
577 @api_version("1.0.0", "2.3.0", __DICT_VERSION_STATUS) 583 @api_version("1.0.0", "2.6.0", __DICT_VERSION_STATUS)
578 def timeline_hashtag(self, hashtag, local=False, max_id=None, since_id=None, limit=None, only_media=False): 584 def timeline_hashtag(self, hashtag, local=False, max_id=None, min_id=None, since_id=None, limit=None, only_media=False):
579 """ 585 """
580 Fetch a timeline of toots with a given hashtag. The hashtag parameter 586 Fetch a timeline of toots with a given hashtag. The hashtag parameter
581 should not contain the leading #. 587 should not contain the leading #.
@@ -591,6 +597,9 @@ class Mastodon:
591 if max_id != None: 597 if max_id != None:
592 max_id = self.__unpack_id(max_id) 598 max_id = self.__unpack_id(max_id)
593 599
600 if min_id != None:
601 min_id = self.__unpack_id(min_id)
602
594 if since_id != None: 603 if since_id != None:
595 since_id = self.__unpack_id(since_id) 604 since_id = self.__unpack_id(since_id)
596 605
@@ -607,16 +616,16 @@ class Mastodon:
607 616
608 return self.__api_request('GET', url, params) 617 return self.__api_request('GET', url, params)
609 618
610 @api_version("2.1.0", "2.1.0", __DICT_VERSION_STATUS) 619 @api_version("2.1.0", "2.6.0", __DICT_VERSION_STATUS)
611 def timeline_list(self, id, max_id=None, since_id=None, limit=None): 620 def timeline_list(self, id, max_id=None, min_id=None, since_id=None, limit=None):
612 """ 621 """
613 Fetches a timeline containing all the toots by users in a given list. 622 Fetches a timeline containing all the toots by users in a given list.
614 623
615 Returns a list of `toot dicts`_. 624 Returns a list of `toot dicts`_.
616 """ 625 """
617 id = self.__unpack_id(id) 626 id = self.__unpack_id(id)
618 return self.timeline('list/{0}'.format(id), max_id=max_id, 627 return self.timeline('list/{0}'.format(id), max_id=max_id,
619 since_id=since_id, limit=limit) 628 min_id=min_id, since_id=since_id, limit=limit)
620 629
621 ### 630 ###
622 # Reading data: Statuses 631 # Reading data: Statuses
@@ -690,8 +699,8 @@ class Mastodon:
690 ### 699 ###
691 # Reading data: Notifications 700 # Reading data: Notifications
692 ### 701 ###
693 @api_version("1.0.0", "1.0.0", __DICT_VERSION_NOTIFICATION) 702 @api_version("1.0.0", "2.6.0", __DICT_VERSION_NOTIFICATION)
694 def notifications(self, id=None, max_id=None, since_id=None, limit=None): 703 def notifications(self, id=None, max_id=None, min_id=None, since_id=None, limit=None):
695 """ 704 """
696 Fetch notifications (mentions, favourites, reblogs, follows) for the logged-in 705 Fetch notifications (mentions, favourites, reblogs, follows) for the logged-in
697 user. 706 user.
@@ -703,6 +712,9 @@ class Mastodon:
703 if max_id != None: 712 if max_id != None:
704 max_id = self.__unpack_id(max_id) 713 max_id = self.__unpack_id(max_id)
705 714
715 if min_id != None:
716 min_id = self.__unpack_id(min_id)
717
706 if since_id != None: 718 if since_id != None:
707 since_id = self.__unpack_id(since_id) 719 since_id = self.__unpack_id(since_id)
708 720
@@ -740,7 +752,7 @@ class Mastodon:
740 return self.__api_request('GET', '/api/v1/accounts/verify_credentials') 752 return self.__api_request('GET', '/api/v1/accounts/verify_credentials')
741 753
742 @api_version("1.0.0", "2.7.0", __DICT_VERSION_STATUS) 754 @api_version("1.0.0", "2.7.0", __DICT_VERSION_STATUS)
743 def account_statuses(self, id, only_media=False, pinned=False, exclude_replies=False, max_id=None, since_id=None, limit=None): 755 def account_statuses(self, id, only_media=False, pinned=False, exclude_replies=False, max_id=None, min_id=None, since_id=None, limit=None):
744 """ 756 """
745 Fetch statuses by user `id`. Same options as `timeline()`_ are permitted. 757 Fetch statuses by user `id`. Same options as `timeline()`_ are permitted.
746 Returned toots are from the perspective of the logged-in user, i.e. 758 Returned toots are from the perspective of the logged-in user, i.e.
@@ -760,6 +772,9 @@ class Mastodon:
760 if max_id != None: 772 if max_id != None:
761 max_id = self.__unpack_id(max_id) 773 max_id = self.__unpack_id(max_id)
762 774
775 if min_id != None:
776 min_id = self.__unpack_id(min_id)
777
763 if since_id != None: 778 if since_id != None:
764 since_id = self.__unpack_id(since_id) 779 since_id = self.__unpack_id(since_id)
765 780
@@ -774,8 +789,8 @@ class Mastodon:
774 url = '/api/v1/accounts/{0}/statuses'.format(str(id)) 789 url = '/api/v1/accounts/{0}/statuses'.format(str(id))
775 return self.__api_request('GET', url, params) 790 return self.__api_request('GET', url, params)
776 791
777 @api_version("1.0.0", "2.1.0", __DICT_VERSION_ACCOUNT) 792 @api_version("1.0.0", "2.6.0", __DICT_VERSION_ACCOUNT)
778 def account_following(self, id, max_id=None, since_id=None, limit=None): 793 def account_following(self, id, max_id=None, min_id=None, since_id=None, limit=None):
779 """ 794 """
780 Fetch users the given user is following. 795 Fetch users the given user is following.
781 796
@@ -785,6 +800,9 @@ class Mastodon:
785 if max_id != None: 800 if max_id != None:
786 max_id = self.__unpack_id(max_id) 801 max_id = self.__unpack_id(max_id)
787 802
803 if min_id != None:
804 min_id = self.__unpack_id(min_id)
805
788 if since_id != None: 806 if since_id != None:
789 since_id = self.__unpack_id(since_id) 807 since_id = self.__unpack_id(since_id)
790 808
@@ -792,8 +810,8 @@ class Mastodon:
792 url = '/api/v1/accounts/{0}/following'.format(str(id)) 810 url = '/api/v1/accounts/{0}/following'.format(str(id))
793 return self.__api_request('GET', url, params) 811 return self.__api_request('GET', url, params)
794 812
795 @api_version("1.0.0", "2.1.0", __DICT_VERSION_ACCOUNT) 813 @api_version("1.0.0", "2.6.0", __DICT_VERSION_ACCOUNT)
796 def account_followers(self, id, max_id=None, since_id=None, limit=None): 814 def account_followers(self, id, max_id=None, min_id=None, since_id=None, limit=None):
797 """ 815 """
798 Fetch users the given user is followed by. 816 Fetch users the given user is followed by.
799 817
@@ -803,6 +821,9 @@ class Mastodon:
803 if max_id != None: 821 if max_id != None:
804 max_id = self.__unpack_id(max_id) 822 max_id = self.__unpack_id(max_id)
805 823
824 if min_id != None:
825 min_id = self.__unpack_id(min_id)
826
806 if since_id != None: 827 if since_id != None:
807 since_id = self.__unpack_id(since_id) 828 since_id = self.__unpack_id(since_id)
808 829
@@ -986,8 +1007,8 @@ class Mastodon:
986 id = self.__unpack_id(id) 1007 id = self.__unpack_id(id)
987 return self.__api_request('GET', '/api/v1/lists/{0}'.format(id)) 1008 return self.__api_request('GET', '/api/v1/lists/{0}'.format(id))
988 1009
989 @api_version("2.1.0", "2.1.0", __DICT_VERSION_ACCOUNT) 1010 @api_version("2.1.0", "2.6.0", __DICT_VERSION_ACCOUNT)
990 def list_accounts(self, id, max_id=None, since_id=None, limit=None): 1011 def list_accounts(self, id, max_id=None, min_id=None, since_id=None, limit=None):
991 """ 1012 """
992 Get the accounts that are on the given list. A `limit` of 0 can 1013 Get the accounts that are on the given list. A `limit` of 0 can
993 be specified to get all accounts without pagination. 1014 be specified to get all accounts without pagination.
@@ -999,6 +1020,9 @@ class Mastodon:
999 if max_id != None: 1020 if max_id != None:
1000 max_id = self.__unpack_id(max_id) 1021 max_id = self.__unpack_id(max_id)
1001 1022
1023 if min_id != None:
1024 min_id = self.__unpack_id(min_id)
1025
1002 if since_id != None: 1026 if since_id != None:
1003 since_id = self.__unpack_id(since_id) 1027 since_id = self.__unpack_id(since_id)
1004 1028
@@ -1008,8 +1032,8 @@ class Mastodon:
1008 ### 1032 ###
1009 # Reading data: Mutes and Blocks 1033 # Reading data: Mutes and Blocks
1010 ### 1034 ###
1011 @api_version("1.1.0", "2.1.0", __DICT_VERSION_ACCOUNT) 1035 @api_version("1.1.0", "2.6.0", __DICT_VERSION_ACCOUNT)
1012 def mutes(self, max_id=None, since_id=None, limit=None): 1036 def mutes(self, max_id=None, min_id=None, since_id=None, limit=None):
1013 """ 1037 """
1014 Fetch a list of users muted by the logged-in user. 1038 Fetch a list of users muted by the logged-in user.
1015 1039
@@ -1018,14 +1042,17 @@ class Mastodon:
1018 if max_id != None: 1042 if max_id != None:
1019 max_id = self.__unpack_id(max_id) 1043 max_id = self.__unpack_id(max_id)
1020 1044
1045 if min_id != None:
1046 min_id = self.__unpack_id(min_id)
1047
1021 if since_id != None: 1048 if since_id != None:
1022 since_id = self.__unpack_id(since_id) 1049 since_id = self.__unpack_id(since_id)
1023 1050
1024 params = self.__generate_params(locals()) 1051 params = self.__generate_params(locals())
1025 return self.__api_request('GET', '/api/v1/mutes', params) 1052 return self.__api_request('GET', '/api/v1/mutes', params)
1026 1053
1027 @api_version("1.0.0", "2.1.0", __DICT_VERSION_ACCOUNT) 1054 @api_version("1.0.0", "2.6.0", __DICT_VERSION_ACCOUNT)
1028 def blocks(self, max_id=None, since_id=None, limit=None): 1055 def blocks(self, max_id=None, min_id=None, since_id=None, limit=None):
1029 """ 1056 """
1030 Fetch a list of users blocked by the logged-in user. 1057 Fetch a list of users blocked by the logged-in user.
1031 1058
@@ -1034,6 +1061,9 @@ class Mastodon:
1034 if max_id != None: 1061 if max_id != None:
1035 max_id = self.__unpack_id(max_id) 1062 max_id = self.__unpack_id(max_id)
1036 1063
1064 if min_id != None:
1065 min_id = self.__unpack_id(min_id)
1066
1037 if since_id != None: 1067 if since_id != None:
1038 since_id = self.__unpack_id(since_id) 1068 since_id = self.__unpack_id(since_id)
1039 1069
@@ -1058,8 +1088,8 @@ class Mastodon:
1058 ### 1088 ###
1059 # Reading data: Favourites 1089 # Reading data: Favourites
1060 ### 1090 ###
1061 @api_version("1.0.0", "2.0.0", __DICT_VERSION_STATUS) 1091 @api_version("1.0.0", "2.6.0", __DICT_VERSION_STATUS)
1062 def favourites(self, max_id=None, since_id=None, limit=None): 1092 def favourites(self, max_id=None, min_id=None, since_id=None, limit=None):
1063 """ 1093 """
1064 Fetch the logged-in user's favourited statuses. 1094 Fetch the logged-in user's favourited statuses.
1065 1095
@@ -1068,6 +1098,9 @@ class Mastodon:
1068 if max_id != None: 1098 if max_id != None:
1069 max_id = self.__unpack_id(max_id) 1099 max_id = self.__unpack_id(max_id)
1070 1100
1101 if min_id != None:
1102 min_id = self.__unpack_id(min_id)
1103
1071 if since_id != None: 1104 if since_id != None:
1072 since_id = self.__unpack_id(since_id) 1105 since_id = self.__unpack_id(since_id)
1073 1106
@@ -1077,8 +1110,8 @@ class Mastodon:
1077 ### 1110 ###
1078 # Reading data: Follow requests 1111 # Reading data: Follow requests
1079 ### 1112 ###
1080 @api_version("1.0.0", "2.1.0", __DICT_VERSION_ACCOUNT) 1113 @api_version("1.0.0", "2.6.0", __DICT_VERSION_ACCOUNT)
1081 def follow_requests(self, max_id=None, since_id=None, limit=None): 1114 def follow_requests(self, max_id=None, min_id=None, since_id=None, limit=None):
1082 """ 1115 """
1083 Fetch the logged-in user's incoming follow requests. 1116 Fetch the logged-in user's incoming follow requests.
1084 1117
@@ -1087,6 +1120,9 @@ class Mastodon:
1087 if max_id != None: 1120 if max_id != None:
1088 max_id = self.__unpack_id(max_id) 1121 max_id = self.__unpack_id(max_id)
1089 1122
1123 if min_id != None:
1124 min_id = self.__unpack_id(min_id)
1125
1090 if since_id != None: 1126 if since_id != None:
1091 since_id = self.__unpack_id(since_id) 1127 since_id = self.__unpack_id(since_id)
1092 1128
@@ -1096,8 +1132,8 @@ class Mastodon:
1096 ### 1132 ###
1097 # Reading data: Domain blocks 1133 # Reading data: Domain blocks
1098 ### 1134 ###
1099 @api_version("1.4.0", "1.4.0", "1.4.0") 1135 @api_version("1.4.0", "2.6.0", "1.4.0")
1100 def domain_blocks(self, max_id=None, since_id=None, limit=None): 1136 def domain_blocks(self, max_id=None, min_id=None, since_id=None, limit=None):
1101 """ 1137 """
1102 Fetch the logged-in user's blocked domains. 1138 Fetch the logged-in user's blocked domains.
1103 1139
@@ -1106,6 +1142,9 @@ class Mastodon:
1106 if max_id != None: 1142 if max_id != None:
1107 max_id = self.__unpack_id(max_id) 1143 max_id = self.__unpack_id(max_id)
1108 1144
1145 if min_id != None:
1146 min_id = self.__unpack_id(min_id)
1147
1109 if since_id != None: 1148 if since_id != None:
1110 since_id = self.__unpack_id(since_id) 1149 since_id = self.__unpack_id(since_id)
1111 1150
Powered by cgit v1.2.3 (git 2.41.0)