diff --git a/examples/detailed_example/detailed_example.py b/examples/detailed_example/detailed_example.py index 4bd428b..83fcb67 100644 --- a/examples/detailed_example/detailed_example.py +++ b/examples/detailed_example/detailed_example.py @@ -2,9 +2,10 @@ This is a detailed example using almost every command of the API """ +import time + import telebot from telebot import types -import time TOKEN = '' diff --git a/examples/inline_example.py b/examples/inline_example.py index 725708e..cc7ba77 100644 --- a/examples/inline_example.py +++ b/examples/inline_example.py @@ -1,8 +1,9 @@ # This example show how to write an inline mode telegramt bot use pyTelegramBotAPI. -import telebot -import time -import sys import logging +import sys +import time + +import telebot from telebot import types API_TOKEN = '' diff --git a/examples/payments_example.py b/examples/payments_example.py index 3e82955..d0f52d4 100644 --- a/examples/payments_example.py +++ b/examples/payments_example.py @@ -1,6 +1,5 @@ import telebot -from telebot.types import LabeledPrice -from telebot.types import ShippingOption +from telebot.types import LabeledPrice, ShippingOption token = '1234567890:AAAABBBBCCCCDDDDeeeeFFFFgggGHHHH' provider_token = '1234567890:TEST:AAAABBBBCCCCDDDD' # @BotFather -> Bot Settings -> Payments diff --git a/examples/telebot_bot/telebot_bot.py b/examples/telebot_bot/telebot_bot.py index 46319ce..b599efe 100644 --- a/examples/telebot_bot/telebot_bot.py +++ b/examples/telebot_bot/telebot_bot.py @@ -3,9 +3,10 @@ # and goes by the name 'TeleBot (@pyTeleBot)'. Join our group to talk to him! # WARNING: Tested with Python 2.7 -import telebot import os +import telebot + text_messages = { 'welcome': u'Please welcome {name}!\n\n' diff --git a/examples/webhook_examples/webhook_aiohttp_echo_bot.py b/examples/webhook_examples/webhook_aiohttp_echo_bot.py index d92cff9..c949b84 100644 --- a/examples/webhook_examples/webhook_aiohttp_echo_bot.py +++ b/examples/webhook_examples/webhook_aiohttp_echo_bot.py @@ -11,7 +11,6 @@ from aiohttp import web import telebot - API_TOKEN = '' WEBHOOK_HOST = '' diff --git a/examples/webhook_examples/webhook_cherrypy_echo_bot.py b/examples/webhook_examples/webhook_cherrypy_echo_bot.py index d0f3da0..c679a01 100644 --- a/examples/webhook_examples/webhook_cherrypy_echo_bot.py +++ b/examples/webhook_examples/webhook_cherrypy_echo_bot.py @@ -4,10 +4,11 @@ # This is a simple echo bot using decorators and webhook with CherryPy # It echoes any incoming text messages and does not use the polling method. -import cherrypy -import telebot import logging +import cherrypy + +import telebot API_TOKEN = '' diff --git a/examples/webhook_examples/webhook_cpython_echo_bot.py b/examples/webhook_examples/webhook_cpython_echo_bot.py index 807b5a7..639dcae 100644 --- a/examples/webhook_examples/webhook_cpython_echo_bot.py +++ b/examples/webhook_examples/webhook_cpython_echo_bot.py @@ -11,10 +11,10 @@ except ImportError: # Python 3 from http.server import BaseHTTPRequestHandler, HTTPServer -import ssl -import telebot import logging +import ssl +import telebot API_TOKEN = '' diff --git a/examples/webhook_examples/webhook_flask_echo_bot.py b/examples/webhook_examples/webhook_flask_echo_bot.py index d0327d7..2567cab 100644 --- a/examples/webhook_examples/webhook_flask_echo_bot.py +++ b/examples/webhook_examples/webhook_flask_echo_bot.py @@ -4,11 +4,12 @@ # This is a simple echo bot using decorators and webhook with flask # It echoes any incoming text messages and does not use the polling method. -import flask -import telebot import logging import time +import flask + +import telebot API_TOKEN = '' diff --git a/examples/webhook_examples/webhook_flask_heroku_echo.py b/examples/webhook_examples/webhook_flask_heroku_echo.py index 62d0a90..7bbf2bf 100644 --- a/examples/webhook_examples/webhook_flask_heroku_echo.py +++ b/examples/webhook_examples/webhook_flask_heroku_echo.py @@ -1,8 +1,9 @@ import os -import telebot from flask import Flask, request +import telebot + TOKEN = '' bot = telebot.TeleBot(TOKEN) server = Flask(__name__) diff --git a/examples/webhook_examples/webhook_tornado_echo_bot.py b/examples/webhook_examples/webhook_tornado_echo_bot.py index 538b7b9..c4c64b0 100644 --- a/examples/webhook_examples/webhook_tornado_echo_bot.py +++ b/examples/webhook_examples/webhook_tornado_echo_bot.py @@ -4,13 +4,15 @@ # This example shows webhook echo bot with Tornado web framework # Documenation to Tornado: http://tornadoweb.org -import telebot -import tornado.web -import tornado.ioloop -import tornado.httpserver -import tornado.options import signal +import tornado.httpserver +import tornado.ioloop +import tornado.options +import tornado.web + +import telebot + API_TOKEN = '' WEBHOOK_CERT = "./cert.pem" WEBHOOK_PKEY = "./pkey.pem" diff --git a/telebot/__init__.py b/telebot/__init__.py index 5a4ec35..95fa03a 100644 --- a/telebot/__init__.py +++ b/telebot/__init__.py @@ -1,16 +1,15 @@ # -*- coding: utf-8 -*- from __future__ import print_function -import threading -import time -import re -import sys -import six - +import logging import os import pickle +import re +import sys +import threading +import time -import logging +import six logger = logging.getLogger('TeleBot') formatter = logging.Formatter( diff --git a/telebot/util.py b/telebot/util.py index e7af2c7..034aa49 100644 --- a/telebot/util.py +++ b/telebot/util.py @@ -1,10 +1,11 @@ # -*- coding: utf-8 -*- import random +import re import string +import sys import threading import traceback -import re -import sys + import six from six import string_types