{ "info": { "author": "Dima Shebotinov", "author_email": "groovestreetmagic@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: Python Software Foundation License" ], "description": "# Telegram-botup\n\nLibrary for fast development and simple deployment of Telegram bots. She includes:\n\n- **Dispatcher** for handlers registration and receiving incoming updates\n- **Form** for working with Telegram API\n- **Sender**-worker for asynchronus requests\n- Other utils, types and etc\n\n# Features\n\n- Full support of types and methods telegram API\n- Built-in **Sender**-worker for making requests like task by task\n- Simple switching between synchronus and asynchronus work\n- Simple deployment with wsgi\n- Built-in command-line tool\n- Support of work with socks5-proxy and proxy-url\n\n\n\n# Installation\n```\n$ pip install telegram-botup\n```\n\n# Example\n```\nfrom botup import Dispatcher, Form\nfrom botup.types import InputFile\nfrom flask import Flask, request\n\nfrom my_func import get_random_image\nfrom config import TOKEN\nfrom config import redis_connection as rdb\n\napp = Flask(__name__)\ndispatcher = Dispatcher()\nform = Form(token=TOKEN, connection=rdb)\n\n\ndef start_handler(chat_id, update):\n form.push(\n func=form.send_message,\n chat_id=chat_id,\n text='Hi!\\nTo get image press to /image'\n )\n\n\ndef send_image(chat_id, update):\n path = get_random_image()\n cache = rdb.get(f'cache:{path}')\n if cache:\n input_file = InputFile(file_id=cache)\n form.push(\n func=form.send_photo,\n chat_id=chat_id,\n photo=input_file.as_dict()\n )\n else:\n input_file = InputFile(path=path)\n resp = form.push(\n func=form.send_photo,\n chat_id=chat_id,\n photo=input_file.as_dict()\n ).wait()\n rdb.set(f'cache:{path}', resp.photo[-1].file_id)\n\n\ndispatcher.register_command_handler('/image', send_image)\ndispatcher.register_command_handler('*', start_handler)\n\n\n@app.route(f'/{TOKEN}', methods=['POST'])\ndef index():\n try:\n req = request.get_json()\n dispatcher.handle(req)\n except Exception as exc:\n import traceback\n print(traceback.format_exc())\n return \"!\", 200\n\n```\n\n## Q/A\n\n* *How to set webhook?*\n\n```\n$ botup set_webhook --help\n```\n\n* *How to test bot without requests?*\n\n\nUse **fake_mode=True** on **Form** initialization\n\n```\nform = Form(..., fake_mode=True, ...)\n```\n\nOr use **--fake-mode** on **Sender** starting\n\n```\n$ botup run_sender --token $TOKEN --fake-mode\n```\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "telegram-botup", "package_url": "https://pypi.org/project/telegram-botup/", "platform": "", "project_url": "https://pypi.org/project/telegram-botup/", "project_urls": { "Source Code": "https://bitbucket.org/dimashebo/telegram-botup" }, "release_url": "https://pypi.org/project/telegram-botup/0.4.0/", "requires_dist": [ "Click", "requests", "redis" ], "requires_python": ">=3.6", "summary": "Library for development Telegram bots", "version": "0.4.0" }, "last_serial": 5991506, "releases": { "0.3.0": [ { "comment_text": "", "digests": { "md5": "b079802cb5098f1e4b89ed4940bf6aaf", "sha256": "177bd5a9148ff2ff734304f48bcf1c51f233027f95391ac1d790c23ae87a977e" }, "downloads": -1, "filename": "telegram_botup-0.3.0-py3-none-any.whl", "has_sig": false, "md5_digest": "b079802cb5098f1e4b89ed4940bf6aaf", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 22116, "upload_time": "2019-08-21T08:45:47", "url": "https://files.pythonhosted.org/packages/5b/0e/ee5ea279af7da41a16b91fb2d8abb9ab0867b254d72cd56c8b931af152d0/telegram_botup-0.3.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bbba175081214dea70bfc308f7f4a9a4", "sha256": "ec205a0f895c52d3e226f6e09276f94f9fbe9a4c716add7ae5d3d49964d437bf" }, "downloads": -1, "filename": "telegram-botup-0.3.0.tar.gz", "has_sig": false, "md5_digest": "bbba175081214dea70bfc308f7f4a9a4", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 20247, "upload_time": "2019-08-21T08:45:49", "url": "https://files.pythonhosted.org/packages/c4/2d/109e28e755ce2f4cac8feb967f30ce101ee700b5ecf9cf2c701bca5941b6/telegram-botup-0.3.0.tar.gz" } ], "0.3.8": [ { "comment_text": "", "digests": { "md5": "c65ebfff89f5d715a9073c69069767b0", "sha256": "0f7184683e3d3806b76382384bd97edba6e41e9273a32b082b0224ec7829a476" }, "downloads": -1, "filename": "telegram_botup-0.3.8-py3-none-any.whl", "has_sig": false, "md5_digest": "c65ebfff89f5d715a9073c69069767b0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 22439, "upload_time": "2019-08-26T07:38:09", "url": "https://files.pythonhosted.org/packages/b9/2b/abba5e8625bc0d6e1e5a3f2f0fd1f4d391f39bd692af086e9ee36ddcca01/telegram_botup-0.3.8-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c1587d68c2e5ca1d01b0c4c1efdd7207", "sha256": "2af4d7b545a6ca763e3a8d805f4716f04cce75ccc3aa63669290ab7281583c32" }, "downloads": -1, "filename": "telegram-botup-0.3.8.tar.gz", "has_sig": false, "md5_digest": "c1587d68c2e5ca1d01b0c4c1efdd7207", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 21153, "upload_time": "2019-08-26T07:38:11", "url": "https://files.pythonhosted.org/packages/17/7a/de9b3397612c4602444c95c4d8ded976e1988b9ee80191648ec8d590aea4/telegram-botup-0.3.8.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "08aa9b994ce1c623bad3a7066d0a5aef", "sha256": "be5cf8c299acfcc04a824cb53d7775bfcdef7e4c83cfd0631e15b15f0fd7ec38" }, "downloads": -1, "filename": "telegram_botup-0.4.0-py3-none-any.whl", "has_sig": false, "md5_digest": "08aa9b994ce1c623bad3a7066d0a5aef", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 23766, "upload_time": "2019-10-17T17:51:08", "url": "https://files.pythonhosted.org/packages/b0/94/6dc2174c71dce74c3f8aca3d0c27366108c7399216e9e60602de23ad5263/telegram_botup-0.4.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "af8d2396febd9ce04472e459650517b0", "sha256": "56661a41615cc99576140d3841f52d6da9a9d5fb5ff1306e49880e828685ad47" }, "downloads": -1, "filename": "telegram-botup-0.4.0.tar.gz", "has_sig": false, "md5_digest": "af8d2396febd9ce04472e459650517b0", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 20393, "upload_time": "2019-10-17T17:51:10", "url": "https://files.pythonhosted.org/packages/1c/dc/bf5807f2d1e9babfb426b153a728db3e0eeb724e196be52085777af52418/telegram-botup-0.4.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "08aa9b994ce1c623bad3a7066d0a5aef", "sha256": "be5cf8c299acfcc04a824cb53d7775bfcdef7e4c83cfd0631e15b15f0fd7ec38" }, "downloads": -1, "filename": "telegram_botup-0.4.0-py3-none-any.whl", "has_sig": false, "md5_digest": "08aa9b994ce1c623bad3a7066d0a5aef", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 23766, "upload_time": "2019-10-17T17:51:08", "url": "https://files.pythonhosted.org/packages/b0/94/6dc2174c71dce74c3f8aca3d0c27366108c7399216e9e60602de23ad5263/telegram_botup-0.4.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "af8d2396febd9ce04472e459650517b0", "sha256": "56661a41615cc99576140d3841f52d6da9a9d5fb5ff1306e49880e828685ad47" }, "downloads": -1, "filename": "telegram-botup-0.4.0.tar.gz", "has_sig": false, "md5_digest": "af8d2396febd9ce04472e459650517b0", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 20393, "upload_time": "2019-10-17T17:51:10", "url": "https://files.pythonhosted.org/packages/1c/dc/bf5807f2d1e9babfb426b153a728db3e0eeb724e196be52085777af52418/telegram-botup-0.4.0.tar.gz" } ] }