From d23c4ef319617a2d93bb5665bcdc59bbac659a6b Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Thu, 7 Dec 2017 19:45:03 -0800 Subject: [PATCH] Upload from Imgur to Telegram directly --- plexpy/notifiers.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/plexpy/notifiers.py b/plexpy/notifiers.py index 3e3a8d97..ed0278cb 100644 --- a/plexpy/notifiers.py +++ b/plexpy/notifiers.py @@ -3081,20 +3081,15 @@ class TELEGRAM(Notifier): text = body.encode('utf-8') if self.config['incl_poster'] and kwargs.get('parameters'): - poster_data = {'chat_id': self.config['chat_id'], - 'disable_notification': True} - parameters = kwargs['parameters'] poster_url = parameters.get('poster_url','') if poster_url: - poster_request = requests.get(poster_url) - poster_content = poster_request.content + poster_data = {'photo': poster_url, + 'chat_id': self.config['chat_id'], + 'disable_notification': True} - files = {'photo': (poster_url, poster_content)} - - r = requests.post('https://api.telegram.org/bot{}/sendPhoto'.format(self.config['bot_token']), - data=poster_data, files=files) + r = requests.post('https://api.telegram.org/bot{}/sendPhoto'.format(self.config['bot_token']), json=poster_data) if r.status_code == 200: logger.info(u"PlexPy Notifiers :: {name} poster sent.".format(name=self.NAME))