From df17a8695cba8f643593664f383912951e234540 Mon Sep 17 00:00:00 2001 From: Jinwei Zhao Date: Tue, 31 Jan 2017 18:58:52 +0800 Subject: remove urllib.parse.quote --- async_bot.py | 2 +- async_test.py | 25 +++++++++++++++++++++++++ ingrex/praser.py | 2 +- 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 async_test.py diff --git a/async_bot.py b/async_bot.py index 99c4560..5f33f7e 100755 --- a/async_bot.py +++ b/async_bot.py @@ -135,7 +135,7 @@ def send_message(bot, message, monitor=False): if monitor is True: bot.sendMessage(chat_id="@voamonitor", text=message) else: - bot.sendMessage(chat_id=CHANNEL_NAME, text=urllib.parse.quote(message)) + bot.sendMessage(chat_id=CHANNEL_NAME, text=message) logger.info(get_time() + ": sendMsg " + message) break except telegram.TelegramError: diff --git a/async_test.py b/async_test.py new file mode 100644 index 0000000..41f5cd7 --- /dev/null +++ b/async_test.py @@ -0,0 +1,25 @@ +''' +import aiohttp +import asyncio +import async_timeout + +async def fetch(session, url): + with async_timeout.timeout(10): + async with session.get(url) as response: + return await response.text() + +async def main(loop): + async with aiohttp.ClientSession(loop=loop) as session: + html = await fetch(session, 'http://python.org') + print(html) + +loop = asyncio.get_event_loop() +loop.run_until_complete(main(loop)) +''' + + +import telegram + +bot = telegram.Bot('243806890:AAEFw0bAA2E5hkxtprb7qGM7mZSlcevQs4Y') + +bot.sendMessage(chat_id='-1001052481058', text="Hello") \ No newline at end of file diff --git a/ingrex/praser.py b/ingrex/praser.py index 1d2c03d..97057dd 100755 --- a/ingrex/praser.py +++ b/ingrex/praser.py @@ -63,4 +63,4 @@ class Message(object): else: self.msg = '@' + self.msg - self.msg = self.time + self.msg + self.msg = self.time + ' ' + self.msg -- cgit v1.2.3