aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mastodon/Mastodon.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index ef71078..9b08bcf 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -36,7 +36,12 @@ except:
36 36
37import base64 37import base64
38import json 38import json
39import blurhash 39
40IMPL_HAS_BLURHASH = True
41try:
42 import blurhash
43except:
44 IMPL_HAS_BLURHASH = False
40 45
41try: 46try:
42 from urllib.parse import urlparse 47 from urllib.parse import urlparse
@@ -2385,6 +2390,9 @@ class Mastodon:
2385 For further info and tips for advanced usage, refer to the documentation for the 2390 For further info and tips for advanced usage, refer to the documentation for the
2386 blurhash module: https://github.com/halcy/blurhash-python 2391 blurhash module: https://github.com/halcy/blurhash-python
2387 """ 2392 """
2393 if not IMPL_HAS_BLURHASH:
2394 raise NotImplementedError('To use the blurhash functions, please install the blurhash python module.')
2395
2388 # Figure out what size to decode to 2396 # Figure out what size to decode to
2389 decode_components_x, decode_components_y = blurhash.components(media_dict["blurhash"]) 2397 decode_components_x, decode_components_y = blurhash.components(media_dict["blurhash"])
2390 if size_per_component == False: 2398 if size_per_component == False:
Powered by cgit v1.2.3 (git 2.41.0)