changeset 1:169aa24a8442

Fix Mastodon photo posting.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 22 Jul 2018 14:07:55 -0700
parents a1b7a459326a
children 27543b2e73b9
files silorider/silos/mastodon.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/silorider/silos/mastodon.py	Wed Jul 18 20:46:04 2018 -0700
+++ b/silorider/silos/mastodon.py	Sun Jul 22 14:07:55 2018 -0700
@@ -141,7 +141,8 @@
             tmpfile, headers = urllib.request.urlretrieve(url)
             logger.debug("Using temporary file: %s" % tmpfile)
 
-            return self.client.media_post(tmpfile, mt)
+            with open(tmpfile, 'rb') as tmpfp:
+                return self.client.media_post(tmpfp, mt)
         finally:
             logger.debug("Cleaning up.")
             urllib.request.urlcleanup()