Skip to content

Commit

Permalink
Remove unnecessary monkey patching of peony
Browse files Browse the repository at this point in the history
It's no longer necessary to hack the media types into peony since 1.0
allows configuring them with parameters. Also avoid what seems to be a
bug in aiohttp by forcing chunked uploading.
  • Loading branch information
Noctem committed Jul 8, 2017
1 parent d7a2bcc commit beb251b
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions monocle/notification.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@
if all((conf.TWITTER_CONSUMER_KEY, conf.TWITTER_CONSUMER_SECRET,
conf.TWITTER_ACCESS_KEY, conf.TWITTER_ACCESS_SECRET)):
try:
import peony.utils
def _get_image_metadata(file_):
return 'image/png', 'tweet_image', True, file_
peony.utils.get_image_metadata = _get_image_metadata
from peony import PeonyClient
except ImportError as e:
raise ImportError("You specified a TWITTER_ACCESS_KEY but you don't have peony-twitter installed.") from e
Expand Down Expand Up @@ -514,7 +510,8 @@ async def tweet(self):
try:
media = await client.upload_media(image,
media_type='image/png',
media_category='tweet_image')
media_category='tweet_image',
chunked=True)
media_id = media['media_id']
except Exception:
self.log.exception('Failed to upload Tweet image.')
Expand Down

0 comments on commit beb251b

Please sign in to comment.