Fix pycodestyle

This commit is contained in:
Aarni Halinen
2019-02-08 19:10:36 +02:00
parent 206ec80a9a
commit 3305704926
2 changed files with 5 additions and 4 deletions
+3 -2
View File
@@ -7,6 +7,7 @@ import requests
from django.conf import settings from django.conf import settings
from kaehmy.models import TelegramChannel from kaehmy.models import TelegramChannel
class TelegramBot: class TelegramBot:
''' '''
A telegram bot api for whatever purposes A telegram bot api for whatever purposes
@@ -23,7 +24,7 @@ class TelegramBot:
channels_ids = TelegramChannel.objects.values_list("channel_id", flat=True) channels_ids = TelegramChannel.objects.values_list("channel_id", flat=True)
for id_ in channels_ids: for id_ in channels_ids:
self.send_message(id_, message) self.send_message(id_, message)
def send_message(self, channel_id, message): def send_message(self, channel_id, message):
''' '''
Send message to a chat with given channel_id Send message to a chat with given channel_id
@@ -34,4 +35,4 @@ class TelegramBot:
'parse_mode': 'Markdown' 'parse_mode': 'Markdown'
} }
resp = requests.post(self.send_message_url, json=data) resp = requests.post(self.send_message_url, json=data)
logging.debug(resp.content) logging.debug(resp.content)
+2 -2
View File
@@ -49,7 +49,7 @@ def ohlhafv_submit(request, *args, **kwargs):
} }
) )
send_email(email, subject, message) send_email(email, subject, message)
try: try:
tg_message = render_to_string( tg_message = render_to_string(
'ohlhafv:tgmsg.tpl', { 'ohlhafv:tgmsg.tpl', {
@@ -57,7 +57,7 @@ def ohlhafv_submit(request, *args, **kwargs):
'url': url}) 'url': url})
bot = TelegramBot() bot = TelegramBot()
bot.broadcast(tg_message) bot.broadcast(tg_message)
except: # tg spam is not critical. Ignore on failure except Exception: # tg spam is not critical. Ignore on failure
pass pass
logging.debug( logging.debug(