Repository: python-telegram-bot/python-telegram-bot

Issue:
Remove botan from our library
according to [this](https://github.com/botanio/sdk#py) botan has it's own implementation for python. No need to reinvent the wheel. I suggest we remove it from ptb in the next major (8.0) version.


Discussion:

Resolving patch:
diff --git a/telegram/contrib/__init__.py b/telegram/contrib/__init__.py
deleted file mode 100644
--- a/telegram/contrib/__init__.py
+++ /dev/null
@@ -1,3 +0,0 @@
-from .botan import Botan
-
-__all__ = ['Botan']
diff --git a/telegram/contrib/botan.py b/telegram/contrib/botan.py
deleted file mode 100644
--- a/telegram/contrib/botan.py
+++ /dev/null
@@ -1,43 +0,0 @@
-import logging
-
-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(logging.NullHandler())
-
-
-class Botan(object):
-    """This class helps to send incoming events to your botan analytics account.
-     See more: https://github.com/botanio/sdk#botan-sdk
-    """
-
-    token = ''
-    url_template = 'https://api.botan.io/track?token={token}' \
-                   '&uid={uid}&name={name}&src=python-telegram-bot'
-
-    def __init__(self, token):
-        self.token = token
-        self.logger = logging.getLogger(__name__)
-
-    def track(self, message, event_name='event'):
-        try:
-            uid = message.chat_id
-        except AttributeError:
-            self.logger.warn('No chat_id in message')
-            return False
-        data = message.to_json()
-        try:
-            url = self.url_template.format(
-                token=str(self.token), uid=str(uid), name=quote(event_name))
-            request = Request(
-                url, data=data.encode(), headers={'Content-Type': 'application/json'})
-            urlopen(request)
-            return True
-        except HTTPError as error:
-            self.logger.warn('Botan track error ' + str(error.code) + ':' + error.read().decode(
-                'utf-8'))
-            return False
-        except URLError as error:
-            self.logger.warn('Botan track error ' + str(error.reason))
-            return False


Test patch:
diff --git a/tests/test_botan.py b/tests/test_botan.py
deleted file mode 100644
--- a/tests/test_botan.py
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/usr/bin/env python
-"""This module contains an object that represents Tests for Botan analytics integration"""
-
-import sys
-import unittest
-import os
-
-from flaky import flaky
-
-sys.path.append('.')
-
-from telegram.contrib.botan import Botan
-from tests.base import BaseTest
-
-
-class MessageMock(object):
-    chat_id = None
-
-    def __init__(self, chat_id):
-        self.chat_id = chat_id
-
-    def to_json(self):
-        return "{}"
-
-
-@flaky(3, 1)
-class BotanTest(BaseTest, unittest.TestCase):
-    """This object represents Tests for Botan analytics integration."""
-
-    token = os.environ.get('BOTAN_TOKEN')
-
-    def test_track(self):
-        botan = Botan(self.token)
-        message = MessageMock(self._chat_id)
-        result = botan.track(message, 'named event')
-        self.assertTrue(result)
-
-    def test_track_fail(self):
-        botan = Botan(self.token)
-        botan.url_template = 'https://api.botan.io/traccc?token={token}&uid={uid}&name={name}'
-        message = MessageMock(self._chat_id)
-        result = botan.track(message, 'named event')
-        self.assertFalse(result)
-
-    def test_wrong_message(self):
-        botan = Botan(self.token)
-        message = MessageMock(self._chat_id)
-        message = delattr(message, 'chat_id')
-        result = botan.track(message, 'named event')
-        self.assertFalse(result)
-
-    def test_wrong_endpoint(self):
-        botan = Botan(self.token)
-        botan.url_template = 'https://api.botaaaaan.io/traccc?token={token}&uid={uid}&name={name}'
-        message = MessageMock(self._chat_id)
-        result = botan.track(message, 'named event')
-        self.assertFalse(result)
-
-
-if __name__ == '__main__':
-    unittest.main()