aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mastodon')
-rw-r--r--mastodon/Mastodon.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index 99133cf..7e9f06f 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -57,6 +57,12 @@ try:
57except ImportError: 57except ImportError:
58 magic = None 58 magic = None
59 59
60try:
61 from pathlib import PurePath
62except:
63 class PurePath:
64 pass
65
60### 66###
61# Version check functions, including decorator and parser 67# Version check functions, including decorator and parser
62### 68###
@@ -1450,7 +1456,8 @@ class Mastodon:
1450 `offset`, `min_id` and `max_id` can be used to paginate. 1456 `offset`, `min_id` and `max_id` can be used to paginate.
1451 1457
1452 `exclude_unreviewed` can be used to restrict search results for hashtags to only 1458 `exclude_unreviewed` can be used to restrict search results for hashtags to only
1453 those that have been reviewed by moderators. It is on by default. 1459 those that have been reviewed by moderators. It is on by default. When using the
1460 v1 search API (pre 2.4.1), it is ignored.
1454 1461
1455 Will use search_v1 (no tag dicts in return values) on Mastodon versions before 1462 Will use search_v1 (no tag dicts in return values) on Mastodon versions before
1456 2.4.1), search_v2 otherwise. Parameters other than resolve are only available 1463 2.4.1), search_v2 otherwise. Parameters other than resolve are only available
@@ -1461,7 +1468,7 @@ class Mastodon:
1461 Returns a `search result dict`_, with tags as `hashtag dicts`_. 1468 Returns a `search result dict`_, with tags as `hashtag dicts`_.
1462 """ 1469 """
1463 if self.verify_minimum_version("2.4.1", cached=True): 1470 if self.verify_minimum_version("2.4.1", cached=True):
1464 return self.search_v2(q, resolve=resolve, result_type=result_type, account_id=account_id, offset=offset, min_id=min_id, max_id=max_id) 1471 return self.search_v2(q, resolve=resolve, result_type=result_type, account_id=account_id, offset=offset, min_id=min_id, max_id=max_id, exclude_unreviewed=exclude_unreviewed)
1465 else: 1472 else:
1466 self.__ensure_search_params_acceptable( 1473 self.__ensure_search_params_acceptable(
1467 account_id, offset, min_id, max_id) 1474 account_id, offset, min_id, max_id)
@@ -4101,6 +4108,8 @@ class Mastodon:
4101 return mime_type 4108 return mime_type
4102 4109
4103 def __load_media_file(self, media_file, mime_type=None, file_name=None): 4110 def __load_media_file(self, media_file, mime_type=None, file_name=None):
4111 if isinstance(media_file, PurePath):
4112 media_file = str(media_file)
4104 if isinstance(media_file, str) and os.path.isfile(media_file): 4113 if isinstance(media_file, str) and os.path.isfile(media_file):
4105 mime_type = self.__guess_type(media_file) 4114 mime_type = self.__guess_type(media_file)
4106 media_file = open(media_file, 'rb') 4115 media_file = open(media_file, 'rb')
Powered by cgit v1.2.3 (git 2.41.0)