Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
language: python
python:
- "2.6"
- "2.7"
- "3.3"
- "3.4"
Expand All @@ -13,6 +12,6 @@ install:
- pip install -r requirements-dev.txt
script:
- nosetests -v --with-flaky --no-flaky-report --with-coverage --cover-package=telegram/
- 'if [ $TRAVIS_PYTHON_VERSION != 2.6 ] && [ $TRAVIS_PYTHON_VERSION != 3.3 ] && [ $TRAVIS_PYTHON_VERSION != pypy3 ]; then pre-commit run --all-files; fi'
- 'if [ $TRAVIS_PYTHON_VERSION != 3.3 ] && [ $TRAVIS_PYTHON_VERSION != pypy3 ]; then pre-commit run --all-files; fi'
after_success:
coveralls
3 changes: 1 addition & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ Introduction

This library provides a pure Python interface for the
`Telegram Bot API <https://core.telegram.org/bots/api>`_.
It works with Python versions from 2.6+ (**Note:** Support for 2.6 will be dropped at some point
this year. 2.7 will still be supported).
It's compatible with Python versions 2.7, 3.3+ and `PyPy <http://pypy.org/>`_.
It also works with `Google App Engine <https://cloud.google.com/appengine>`_.

In addition to the pure API implementation, this library features a number of high-level classes to
Expand Down
1 change: 0 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ flake8
nose
pep257
pylint
unittest2
flaky
yapf
pre-commit
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ def requirements():
'Topic :: Internet',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
Expand Down
14 changes: 4 additions & 10 deletions telegram/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
from .error import TelegramError
from .inputfile import InputFile
from .file import File
from .nullhandler import NullHandler
from .emoji import Emoji
from .parsemode import ParseMode
from .messageentity import MessageEntity
Expand Down Expand Up @@ -101,14 +100,9 @@
'InlineQueryResultVenue', 'InlineQueryResultVideo', 'InlineQueryResultVoice',
'InputContactMessageContent', 'InputFile', 'InputLocationMessageContent',
'InputMessageContent', 'InputTextMessageContent', 'InputVenueMessageContent',
'KeyboardButton', 'Location', 'Message', 'MessageEntity', 'NullHandler', 'ParseMode',
'PhotoSize', 'ReplyKeyboardHide', 'ReplyKeyboardMarkup', 'ReplyMarkup', 'Sticker',
'TelegramError', 'TelegramObject', 'Update', 'User', 'UserProfilePhotos', 'Venue',
'Video', 'Voice', 'MAX_MESSAGE_LENGTH', 'MAX_CAPTION_LENGTH', 'SUPPORTED_WEBHOOK_PORTS',
'KeyboardButton', 'Location', 'Message', 'MessageEntity', 'ParseMode', 'PhotoSize',
'ReplyKeyboardHide', 'ReplyKeyboardMarkup', 'ReplyMarkup', 'Sticker', 'TelegramError',
'TelegramObject', 'Update', 'User', 'UserProfilePhotos', 'Venue', 'Video', 'Voice',
'MAX_MESSAGE_LENGTH', 'MAX_CAPTION_LENGTH', 'SUPPORTED_WEBHOOK_PORTS',
'MAX_FILESIZE_DOWNLOAD', 'MAX_FILESIZE_UPLOAD', 'MAX_MESSAGES_PER_SECOND_PER_CHAT',
'MAX_MESSAGES_PER_SECOND', 'MAX_MESSAGES_PER_MINUTE_PER_GROUP']

if version_info < (2, 7):
from warnings import warn
warn("python-telegram-bot will stop supporting Python 2.6 in a future release. "
"Please upgrade your Python version to at least Python 2.7!")
4 changes: 2 additions & 2 deletions telegram/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
import logging

from telegram import (User, Message, Update, Chat, ChatMember, UserProfilePhotos, File,
ReplyMarkup, TelegramObject, NullHandler)
ReplyMarkup, TelegramObject)
from telegram.error import InvalidToken
from telegram.utils import request

logging.getLogger(__name__).addHandler(NullHandler())
logging.getLogger(__name__).addHandler(logging.NullHandler())


class Bot(TelegramObject):
Expand Down
3 changes: 1 addition & 2 deletions telegram/contrib/botan.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import logging
from telegram import NullHandler

from future.moves.urllib.parse import quote
from future.moves.urllib.error import HTTPError, URLError
from future.moves.urllib.request import urlopen, Request

logging.getLogger(__name__).addHandler(NullHandler())
logging.getLogger(__name__).addHandler(logging.NullHandler())


class Botan(object):
Expand Down
4 changes: 2 additions & 2 deletions telegram/ext/dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@

from future.builtins import range

from telegram import (TelegramError, NullHandler)
from telegram import TelegramError
from telegram.utils import request
from telegram.ext.handler import Handler
from telegram.utils.deprecate import deprecate
from telegram.utils.promise import Promise

logging.getLogger(__name__).addHandler(NullHandler())
logging.getLogger(__name__).addHandler(logging.NullHandler())

ASYNC_QUEUE = Queue()
ASYNC_THREADS = set()
Expand Down
4 changes: 2 additions & 2 deletions telegram/ext/updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
from signal import signal, SIGINT, SIGTERM, SIGABRT
from queue import Queue

from telegram import Bot, TelegramError, NullHandler
from telegram import Bot, TelegramError
from telegram.ext import dispatcher, Dispatcher, JobQueue
from telegram.error import Unauthorized, InvalidToken
from telegram.utils.webhookhandler import (WebhookServer, WebhookHandler)

logging.getLogger(__name__).addHandler(NullHandler())
logging.getLogger(__name__).addHandler(logging.NullHandler())


class Updater(object):
Expand Down
32 changes: 0 additions & 32 deletions telegram/nullhandler.py

This file was deleted.

4 changes: 2 additions & 2 deletions telegram/utils/webhookhandler.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging

from telegram import Update, NullHandler
from telegram import Update
from future.utils import bytes_to_native_str
from threading import Lock
import json
Expand All @@ -9,7 +9,7 @@
except ImportError:
import http.server as BaseHTTPServer

logging.getLogger(__name__).addHandler(NullHandler())
logging.getLogger(__name__).addHandler(logging.NullHandler())


class _InvalidPost(Exception):
Expand Down
6 changes: 1 addition & 5 deletions tests/test_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,10 @@
import re
from datetime import datetime
import sys
import unittest

from flaky import flaky

if sys.version_info[0:2] == (2, 6):
import unittest2 as unittest
else:
import unittest

sys.path.append('.')

import telegram
Expand Down
6 changes: 1 addition & 5 deletions tests/test_choseninlineresult.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@
ChosenInlineResult"""

import sys

if sys.version_info[0:2] == (2, 6):
import unittest2 as unittest
else:
import unittest
import unittest

sys.path.append('.')

Expand Down
6 changes: 1 addition & 5 deletions tests/test_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,10 @@
"""Test the Telegram constants."""

import sys
import unittest

from flaky import flaky

if sys.version_info[0:2] == (2, 6):
import unittest2 as unittest
else:
import unittest

sys.path.append('.')

import telegram
Expand Down
6 changes: 1 addition & 5 deletions tests/test_conversationhandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,9 @@
"""
import logging
import sys
import unittest
from time import sleep

if sys.version_info[0:2] == (2, 6):
import unittest2 as unittest
else:
import unittest

try:
# python2
from urllib2 import urlopen, Request, HTTPError
Expand Down
6 changes: 1 addition & 5 deletions tests/test_inlinekeyboardbutton.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@
"""This module contains a object that represents Tests for Telegram InlineKeyboardButton"""

import sys

if sys.version_info[0:2] == (2, 6):
import unittest2 as unittest
else:
import unittest
import unittest

sys.path.append('.')

Expand Down
6 changes: 1 addition & 5 deletions tests/test_inlinequery.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@
InlineQuery"""

import sys

if sys.version_info[0:2] == (2, 6):
import unittest2 as unittest
else:
import unittest
import unittest

sys.path.append('.')

Expand Down
6 changes: 1 addition & 5 deletions tests/test_inlinequeryresultarticle.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@
InlineQueryResultArticle"""

import sys

if sys.version_info[0:2] == (2, 6):
import unittest2 as unittest
else:
import unittest
import unittest

sys.path.append('.')

Expand Down
6 changes: 1 addition & 5 deletions tests/test_inlinequeryresultaudio.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@
InlineQueryResultAudio"""

import sys

if sys.version_info[0:2] == (2, 6):
import unittest2 as unittest
else:
import unittest
import unittest

sys.path.append('.')

Expand Down
6 changes: 1 addition & 5 deletions tests/test_inlinequeryresultcachedaudio.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@
InlineQueryResultCachedAudio"""

import sys

if sys.version_info[0:2] == (2, 6):
import unittest2 as unittest
else:
import unittest
import unittest

sys.path.append('.')

Expand Down
6 changes: 1 addition & 5 deletions tests/test_inlinequeryresultcacheddocument.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@
InlineQueryResultCachedDocument"""

import sys

if sys.version_info[0:2] == (2, 6):
import unittest2 as unittest
else:
import unittest
import unittest

sys.path.append('.')

Expand Down
6 changes: 1 addition & 5 deletions tests/test_inlinequeryresultcachedgif.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@
InlineQueryResultCachedGif"""

import sys

if sys.version_info[0:2] == (2, 6):
import unittest2 as unittest
else:
import unittest
import unittest

sys.path.append('.')

Expand Down
6 changes: 1 addition & 5 deletions tests/test_inlinequeryresultcachedmpeg4gif.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@
InlineQueryResultCachedMpeg4Gif"""

import sys

if sys.version_info[0:2] == (2, 6):
import unittest2 as unittest
else:
import unittest
import unittest

sys.path.append('.')

Expand Down
6 changes: 1 addition & 5 deletions tests/test_inlinequeryresultcachedphoto.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@
InlineQueryResultCachedPhoto"""

import sys

if sys.version_info[0:2] == (2, 6):
import unittest2 as unittest
else:
import unittest
import unittest

sys.path.append('.')

Expand Down
6 changes: 1 addition & 5 deletions tests/test_inlinequeryresultcachedsticker.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@
InlineQueryResultCachedSticker"""

import sys

if sys.version_info[0:2] == (2, 6):
import unittest2 as unittest
else:
import unittest
import unittest

sys.path.append('.')

Expand Down
6 changes: 1 addition & 5 deletions tests/test_inlinequeryresultcachedvideo.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@
InlineQueryResultCachedVideo"""

import sys

if sys.version_info[0:2] == (2, 6):
import unittest2 as unittest
else:
import unittest
import unittest

sys.path.append('.')

Expand Down
6 changes: 1 addition & 5 deletions tests/test_inlinequeryresultcachedvoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@
InlineQueryResultCachedVoice"""

import sys

if sys.version_info[0:2] == (2, 6):
import unittest2 as unittest
else:
import unittest
import unittest

sys.path.append('.')

Expand Down
Loading