aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenz Diener <[email protected]>2019-10-12 20:13:38 +0200
committerLorenz Diener <[email protected]>2019-10-12 20:13:38 +0200
commitf421b1e4984e1811153032cb56e8fd191a0e6307 (patch)
treefa33433139c06563426246bee1bc38be1ae12ef6 /mastodon/Mastodon.py
parent0b952aef124af09b6ea1267aac48bea6fc12f710 (diff)
downloadmastodon.py-f421b1e4984e1811153032cb56e8fd191a0e6307.tar.gz
Add new parameter for search
Diffstat (limited to 'mastodon/Mastodon.py')
-rw-r--r--mastodon/Mastodon.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index 47f76e1..c0d4c35 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -1207,7 +1207,7 @@ class Mastodon:
1207 raise MastodonVersionError("Advanced search parameters require Mastodon 2.8.0+") 1207 raise MastodonVersionError("Advanced search parameters require Mastodon 2.8.0+")
1208 1208
1209 @api_version("1.1.0", "2.8.0", __DICT_VERSION_SEARCHRESULT) 1209 @api_version("1.1.0", "2.8.0", __DICT_VERSION_SEARCHRESULT)
1210 def search(self, q, resolve=True, result_type=None, account_id=None, offset=None, min_id=None, max_id=None): 1210 def search(self, q, resolve=True, result_type=None, account_id=None, offset=None, min_id=None, max_id=None, exclude_unreviewed=True):
1211 """ 1211 """
1212 Fetch matching hashtags, accounts and statuses. Will perform webfinger 1212 Fetch matching hashtags, accounts and statuses. Will perform webfinger
1213 lookups if resolve is True. Full-text search is only enabled if 1213 lookups if resolve is True. Full-text search is only enabled if
@@ -1221,6 +1221,9 @@ class Mastodon:
1221 1221
1222 `offset`, `min_id` and `max_id` can be used to paginate. 1222 `offset`, `min_id` and `max_id` can be used to paginate.
1223 1223
1224 `exclude_unreviewed` can be used to restrict search results for hashtags to only
1225 those that have been reviewed by moderators. It is on by default.
1226
1224 Will use search_v1 (no tag dicts in return values) on Mastodon versions before 1227 Will use search_v1 (no tag dicts in return values) on Mastodon versions before
1225 2.4.1), search_v2 otherwise. Parameters other than resolve are only available 1228 2.4.1), search_v2 otherwise. Parameters other than resolve are only available
1226 on Mastodon 2.8.0 or above - this function will throw a MastodonVersionError 1229 on Mastodon 2.8.0 or above - this function will throw a MastodonVersionError
@@ -1250,10 +1253,12 @@ class Mastodon:
1250 return self.__api_request('GET', '/api/v1/search', params) 1253 return self.__api_request('GET', '/api/v1/search', params)
1251 1254
1252 @api_version("2.4.1", "2.8.0", __DICT_VERSION_SEARCHRESULT) 1255 @api_version("2.4.1", "2.8.0", __DICT_VERSION_SEARCHRESULT)
1253 def search_v2(self, q, resolve=True, result_type=None, account_id=None, offset=None, min_id=None, max_id=None): 1256 def search_v2(self, q, resolve=True, result_type=None, account_id=None, offset=None, min_id=None, max_id=None, exclude_unreviewed=True):
1254 """ 1257 """
1255 Identical to `search_v1()`, except in that it returns tags as 1258 Identical to `search_v1()`, except in that it returns tags as
1256 `hashtag dicts`_, has more parameters, and resolves by default. 1259 `hashtag dicts`_, has more parameters, and resolves by default.
1260
1261 For more details documentation, please see `search()`
1257 1262
1258 Returns a `search result dict`_. 1263 Returns a `search result dict`_.
1259 """ 1264 """
@@ -1261,7 +1266,10 @@ class Mastodon:
1261 params = self.__generate_params(locals()) 1266 params = self.__generate_params(locals())
1262 1267
1263 if resolve == False: 1268 if resolve == False:
1264 del params['resolve'] 1269 del params["resolve"]
1270
1271 if exclude_unreviewed == False or not self.verify_minimum_version("3.0.0", cached=True):
1272 del params["exclude_unreviewed"]
1265 1273
1266 if "result_type" in params: 1274 if "result_type" in params:
1267 params["type"] = params["result_type"] 1275 params["type"] = params["result_type"]
Powered by cgit v1.2.3 (git 2.41.0)