1{ stdenv, fetchPypi, buildPythonPackage, certifi, future, urllib3 }:
2
3buildPythonPackage rec {
4 pname = "python-telegram-bot";
5 version = "9.0.0";
6
7 src = fetchPypi {
8 inherit pname version;
9 sha256 = "0a5b4wfc6ms7kblynw2h3ygpww98kyz5n8iibqbdyykwx8xj7hzm";
10 };
11
12 prePatch = ''
13 rm -rf telegram/vendor
14 substituteInPlace telegram/utils/request.py \
15 --replace "import telegram.vendor.ptb_urllib3.urllib3 as urllib3" "import urllib3 as urllib3" \
16 --replace "import telegram.vendor.ptb_urllib3.urllib3.contrib.appengine as appengine" "import urllib3.contrib.appengine as appengine" \
17 --replace "from telegram.vendor.ptb_urllib3.urllib3.connection import HTTPConnection" "from urllib3.connection import HTTPConnection" \
18 --replace "from telegram.vendor.ptb_urllib3.urllib3.util.timeout import Timeout" "from urllib3.util.timeout import Timeout"
19 '';
20
21 propagatedBuildInputs = [ certifi future urllib3 ];
22
23 doCheck = false;
24
25 meta = with stdenv.lib; {
26 description = "This library provides a pure Python interface for the Telegram Bot API.";
27 homepage = https://python-telegram-bot.org;
28 license = licenses.lgpl3;
29 maintainers = with maintainers; [ veprbl ];
30 };
31}