Saravanan666/pypi-org huggingface dataset:
Package: telectron
Telegram MTProto API Framework for PythonDocumentation•Releases•CommunitytelectronfromtelectronimportClient,filtersapp=Client("my_account")@app.on_message(filters.private)asyncdefhello(client,message):awaitmessage.reply_text(f"Hello{message.from_user.mention}")app.run()telectronis a modern, elegant and easy-to-useTelegramclient library framework written
from the ground up in Python and C. It enables you to easily create custom Telegram client applications for both user
and bot identities (bot API alternative) via theMTProto API.FeaturesEasy: You can install telectron with pip and start building your applications right away.Elegant: Low-level details are abstracted and re-presented in a much nicer and easier way.Fast: Crypto parts are boosted up byTgCrypto, a high-performance library
written in pure C.Asynchronous: Allows both synchronous and asynchronous models to fit all usage needs.Documented: API methods, types and public interfaces are allwell documented.Type-hinted: Types and methods are all type-hinted, enabling excellent editor support.Updated, to make use of the latest Telegram API version and features.Bot API-like: Similar to the Bot API in its simplicity, but much more powerful and detailed.Pluggable: The Smart Plugin system allows to write components with minimal boilerplate code.Comprehensive: Execute any advanced action an official client is able to do, and even more.RequirementsPython 3.6 or higher.ATelegram API key.Installingpip3installtelectronResourcesThe docs contain lots of resources to help you get started with telectron:https://docs.telectron.org.Seeking extra help? Come join and ask our community:https://t.me/telectron.For other kind of inquiries, you can send amessageor ane-mail.Copyright & LicenseCopyright (C) 2017-2021 Dan <https://github.com/delivrance>Licensed under the terms of theGNU Lesser General Public License v3 or later (LGPLv3+)
Package: teleexception
Tele Log统一的异常类 python package。how to commpilepythonsetup.pysdistbdist_wheelhow to releasetwineupload-rpypidist/*.whlhow to installpipinstallteleexceptionhow to usefromteleexceptionimportHTTPStatus,StatusExceptionstatus=HTTPStatus.FORBIDDENraiseStatusException(status.value,status.phrase)版本：错误码定义规范（2022.10.18）：https://doc.weixin.qq.com/sheet/e3_AQ4AhgZUAJ83tl2k4qhSeaoRLQ2T0?scode=AGIACAeJAA0NBzCa2KARYAMgazAD00.1.x：旧版错误码（没有复用，已弃用）0.2.x：新版错误码（复用错误码）0.3.x: 增加数字生活错误码错误码位数均为 6 位数，共分为 8 大类：通用错误码：4xxxxx通用：40xxxx图片：41xxxx文本：42xxxx音频：43xxxx视频：44xxxx数据库：45xxxx系统运行错误码：5xxxxx业务相关错误码：6xxxxx人体相关业务：600xxx人脸相关业务：601xxx说明：错误码和 message 一一对应，details 根据业务字段选择性返回描述性说明，不做强制规定。错误码messagedetails400001请求路径错误400002请求方法错误400003请求体内容为空400004请求体非 json 格式400005请求体类型错误400006必传的参数未传400007传递非法参数400008请求体的参数字段类型错误400009请求体的参数字段值为空400010请求体的参数字段值设置错误400011base64 数据处理异常400012文件格式不合法400013文件大小不符合要求400014请求时间范围不合法400015文件下载错误400016必传的参数重复400017时间戳格式不对400018超过个数限制400019请求体的参数字段长度错误410001图片解码错误410002图片尺寸不符合要求420001文本长度超过限制420002文本长度低于阈值420003中文占比过低420004文本不是 UTF8 格式420005文本含有非法字符430001音频解码错误430002音频采样率不符合要求430003音频采样精度不符合要求430004音频声道数不符合要求430005音频长度不符合要求440001视频解码错误440002视频长度不符合要求440003视频尺寸不符合要求450001数据库操作失败450002请求的数据库不存在450003请求的数据库已存在450004请求的数据库实体不存在450005请求的数据库实体已存在500001服务接口异常，请联系管理员500002操作数据库异常，请联系管理员500003模型推理错误，请联系管理员600001人体特征提取错误600002未检测到人体601001人脸特征提取错误610002未检测到人脸620001Roi 不符合规范数字生活错误码错误码messagedetails0请求成功1001参数错误1002请求异常1003内部服务异常1004获取刷新地址异常1005上传文件异常1006图像等资源异常1007流文件不合法1008算法编码错误
Package: telefier
Telefier - Telegram notifier utilitySimple Telegram notification utility to inject on your python app or script.Get startedPre-requisitesYou have to setup a Telegram bot (more info here):Connect to@BotFatherand create Telegram BotGet api id and hash fromTelegram appsGet bot token from @BotFatherUsageFirst install the package through pip:pip3 install telefier#!/usr/bin/env python3fromtelefierimportTelefier# create telefiertelefier=Telefier(<api_id>,<api_hash>,<token>)telefier.connect()# send messagetelefier.notify(<username>,<messagehere>)usernameis the telegram username of the one who is gonna recieve the message
Package: telefilebot
telefilebotSometimes you have code that runs a long time and you do not want to
continuously check if it has finished. If that code writes a file to the disk at
the end, maybe you just want a text message when that file is created or
modified?telefilebotallows you to do this with as a simple background listener. All
you need is an input YAML file and you can monitor multiple directories for
various new files being created.InstallationpipinstalltelefilebotUsageSay you have two directories you want to monitor. In one of them you want to
look for text files (files ending with a .txt extension) and the other you only
want to scan the top two level directories.First you need tocreate a telegram
botand attach it to some group where it can message you.Now, create a YAML file that looks like this:name:"file_monitor"chat_id:"-XXXXXXXX"token:"XXXXXXX"logging:level:"INFO"directories:"~/my_dir1":extensions:-.txt"~/my_dir2":recursion_limit:0wait_time:1What do these things mean?The name just names the bot.Thechat_idandtokenare from the group and bot you created.loggingsets the verbosity of the printout in the terminal.For each directory you want to monitor, create an entry with the directory path. If you want to monitor only certain file
extensions, list them under the director. If you only want to recurse down to a
certain level in the file structure, enter a recursion limit (herezeromeans
only the path entered and no sub-folders will be scanned).Finally, thewait_timeargument specifies in minutes how long to wait between
checks of the file system.Now simply fire up a tmux session (or however you want to the bot to run in the
background) and entertelefilebot--fileinput.ymland you are done! Your bot will let you know when new files are added or modified.Free software: GNU General Public License v3Documentation:https://telefilebot.readthedocs.io.
Package: telefly
TeleflyCreate Telegram bots in Python.ImportantThis package was only created forOYSA. It will not be further developed or maintained but stays online for understanding the OYSA-Code. Look atpythin-telegram-botfor a python telegram bot wrapper.FeaturesSimple to useVery lightweightUsage$pipinstallteleflyfromteleflyimportteleflytf=telefly(TOKEN)tf.sendMessage(MESSAGE,chatID)
Package: telega-compose
This is a wrapper ondocker-compose, which extendscompose filesyntax to keep several configurations (states) of your services in one file, with similar to docker-compose file syntax using native YAMLanchors and aliases.How it works:Render in-memory docker-compose file for required state from states file.Call docker-compose app with rendered file (state) and apply required docker-compose command on it.States file reference:It’s a YAML file with two required sections:composeandstates.Sectioncomposeis regular docker-compose config excludingservicessection:compose:version:'3.4'configs:my_config:file:./my_config.txtmy_other_config:external:truesecrets:my_secret:file:./my_secret.txtmy_other_secret:external:truevolumes:data:media:Sectionstatesis a list of states with description ofservicessection for each state:states:live:services:backend:*backend_servicedatabase:*database_servicewebserver:*webserver_serviceYou can describe service in separate section or insidestatessection. Also, you can inherit early described service and override some parameters in place:states:local:services:database:&database_local_service<<:*database_serviceports:-"127.0.0.1:5432:5432"The rest of the sections you can use for you own purposes. For example to configure logging for all services:---compose:...config:logging:&logging_configdriver:"json-file"options:max-size:50mcomponents:backend:&backend_service...logging:*logging_configdatabase:&database_service...logging:*logging_configwebserver:&webserver_service...logging:*logging_configstates:live:services:backend:*backend_servicedatabase:*database_servicewebserver:*webserver_serviceCLI usage:tcompose[-h][-fFILE]state[docker-composeparameters]Positional arguments:state- state to render docker-compose filedocker-compose parameters- anycommand and its parameters accepted by docker-composeexcept parameter for docker-compose file (-f,–file)Optional arguments:-h,–help- to show help message-f FILE,–file FILE- path to states file, by default:states.ymlExamples:tcomposelocal_devconfigtcomposelive-f/path/to/my-custom-states.ymlup-dtcomposeqa-f/path/to/states.yml--project-nameacmeup
Package: telegaden
TelegadenDescriptionPython Telegram TDLib sync client
Python API for thetdliblibrary.
It helps you build your own Telegram clients.Installationpip install telegadenExamplefromtelegaimportTelegramTDLibClientfromtelega.clientimportProxyTypestelegram_client=TelegramTDLibClient(api_id=777,api_hash='abc',phone='911',database_encryption_key='NAd62byYz7em',# see all parameters in source code)telegram_client.set_proxy('111.111.111.111',8080,ProxyTypes.proxyTypeHttp)# telegram_client.check_proxy()  # ping if you needifnottelegram_client.is_authorized():password=input('2 factor auth password (if you have): ')telegram_client.auth_request()sms_code=input('sms_code: ')telegram_client.send_sms_code(sms_code,password)print(telegram_client.get_all_chats())LoggingJust set config for 'telega' logger.
Also you can set C++ logging level - TelegramTDLibClient(tdlib_log_level=3)importlogging.configLOGGING={'version':1,'disable_existing_loggers':False,'formatters':{'main':{'format':'[%(levelname)s] [%(asctime)s] [%(module)s:%(lineno)d]%(message)s','datefmt':'%d/%m/%Y %H:%M:%S'}},'handlers':{'console':{'level':'DEBUG','class':'logging.StreamHandler','formatter':'main'},},'loggers':{'telega':{'handlers':['console'],'propagate':False,'level':'INFO'},}}logging.config.dictConfig(LOGGING)
Package: telega-megaimport
*Telega Megaimport*Framework for parsing CSV, XSL, Google Spreadsheets into Django.Install package with `pip install telega_megaimport`Add 'telega_megaimport' to your project's INSTALLED_APPSTo create new parser, use ./manage.py create_parser commandSpecify --appdir (directory of app, where parser should be created) and --filename (name of parser)Inside new parser, declare cells as they go in parsed document (exact order matters!)Every cell has next args:- required (boolean, if cell is required for row to work correctly)- default (arbitraty, if cell has some default value)Available cell types:- EmptyColumn (for cells you want to skip)- StringColumn (for string-containing cells; use arg 'strip' (boolean) to turn on/off strip on parse)- IntegerColumn- FloatColumn- BooleanColumn (will recognize ['yes', 'y', '+', '1', 'true'] as True, ['no', 'n', '-', '0', 'false'] as False)- ModelColumn (queryset should be declared, lookup_arg by default = 'pk', but can be changed. Returns model (one and only one!) responding by lookup)- ModelTypeColumn (app_label should be declared if model is ambigious)- StatusColumn (list or tuple of `parse_ready_statuses` shpuld be declared. Row will be parsed only if all StatusColumns are parse-ready)***In newly created parser:- Override method row(values) to process result of row-parsing- Override method *attr_name*_handler to prosess result of single cell parsing***To run new parser, use ./manage.py <parser_name> [way_to_file]Next options are supported:--header - Is there header in file? (default - True)--sheet - specify .xls sheet name. Will use first one if nothing specified--progress - set 'True' to use progressbar. Default - False. If True, progressbar module is required--failfast - set 'True' to stop parsing on first error--dryrun - set 'True' to perform parsing without commiting data into database--savestats - set 'True' to collect after-parse statistics into file--google_spreadsheet - set 'True' if you are parsing google-spreadsheet directly (gspread module required)Requirements:- Django >= 1.7- xlrd (for .xls parse)- gspread (Optional; for parsing Spreadsheets)- progressbar (Optional; for ProgressBar generation)To Be Done:- Improved test coverage- Better documentation
Package: teleg-api-bot
# teleg-api-botTelegram Api for new bot system## Getting startedThis project uses Python 3, so you should probably install that, if you haven't already.You should probably take a look at our [Getting Started](https://github.com/LibreLabUCM/teleg-api-bot/wiki/Getting-started-with-the-Telegram-Bot-API) wiki page.## UsageDependencies: Python 3.4, py-yaml"main.py" is the main file to run. It is an example of a bot.Example bot:```python#!/usr/bin/pythonfrom telegbot import telegbotfrom logger import loggerlogger = logger()import time,jsondef receive_message(msg):if msg["date"] < time.time() - 2:return # oldlogger.msg(msg)if msg["text"] == "/help":bot.sendMessage(msg["chat"]["id"], "Text")bot = telegbot('TOKEN')bot.on_receive_message = receive_messagebot.run()```
Package: telegen
usage: telegen [-h] [--overwrite] language [src]

A CLI tool that generates code by parsing the Telegram Bot API page

positional arguments:
language         Output language
src              Source file (will be fetched if not passed)

optional arguments:
-h, --help       show this help message and exit
--overwrite, -o  Delete conflicting files before emitting (default: exit)Docshttps://strychnide.gitlab.io/telegen
Package: telegpt
Telegram bot for ChatGPTSend voice notes in any language (which will be translated to English) or text messages to ChatGPT.Set environment variablesTELEGRAM_BOT_TOKEN: Telegram token from bot created using@BotFatherTELEGRAM_CLIENT_ID: Telegram client ID from@userinfobotOPENAI_API_KEY: OpenAI API key fromOpenAIInstallationpipinstalltelegptLaunch the bottelegptUsageText/newto the bot to restart so it forget the last conversation.Voice notes in any language will be translated to English before being passed to ChatGPT.
Package: telegraf-cloudflare
telegraf-cloudflarePlugin for Telegraf for gathering statistics from CloudflareThis script is in beta version, use with cautionInstallation$pipinstalltelegraf-cloudflareUsage$telegraf-cloudflare--zone-idZONE_ID--emailyou@example.com--api-keySECRETOptional parameters--interval(int)Last 60 minutes (value from 59 to 1): 1 minute resolutionLast 7 hours (value from 419 to 60): 15 minutes resolutionLast 15 hours (value from 899 to 420): 30 minutes resolutionLast 72 hours (value from 4320 to 900): 1 hour resolutionOlder than 3 days (value 525600 to 4320): 1 day resolutionNot all intervals are available in all plans, more information is availablehereExample telegraf configuration[[inputs.exec]]
  interval = 6h
  commands = ["telegraf-cloudflare telegraf-cloudflare --zone-id ZONE_ID --email you@example.com --api-key SECRET"]
  data_format = "influx"LicenseSeeLICENSEfile.
Package: telegraf-kubernetes
telegraf-kubernetesPlugin for Telegraf for gathering statistics from KubernetesThis script is in beta version, use with cautionInstallation$pipinstalltelegraf-kubernetesUsage$telegraf-kubernetes--stats-urlhttp://10.0.0.222:10255/stats/summaryOptional parameters--timeout(int)Example telegraf configuration[[inputs.exec]]
  commands = ["telegraf-kubernetes --stats-url http://10.0.7.222:10255/stats/summary"]
  data_format = "influx"LicenseSeeLICENSEfile.
Package: telegraf-pgbouncer
PollpgBouncerfor stats to submit toTelegrafusing theExec Input Plugin.UsageThe application is meant to be used via the Exec Input PluginExample Telegraf Configuration[[inputs.exec]]
  ## Commands array
  commands = [
    "telegraf-pgbouncer -h localhost -p 6432 -U monitor all"
  ]
  timeout = "5s"
  name_suffix = "_pgbouncer"
  data_format = "json"CLI Usage$ telegraf-pgbouncer --help
usage: pgBouncer Stats Collector for Telegraf

positional arguments:
  COMMAND               The SHOW command to run for extracting stats. Choices:
                        all, lists, databases, mem, pools, stats

optional arguments:
  -h HOST, --host HOST  database server host or socket directory (default: localhost)
  -p PORT, --port PORT  database server port number (default: 5432)
  -U USERNAME, --username USERNAME
                        The PostgreSQL username to operate as (default: pgbouncer)
  -W, --password        Force password prompt (should happen automatically)
                        (default: False)
  -v, --version         output version information, then exit
  -?, --help            show this help, then exitAuthenticationSpecify the password in a.pgpassfile
for the application to connect properly without specifying a password.
Package: telegraf-pyplug
ProblemTelegafis a plugin-driven agent for collecting, processing, aggregating, and writing metrics.
Custom input plugins collect metrics from the system, services, or 3rd party APIs and outputs them in theInfluxDB line protocol format.Printing metrics in the InfluxDB line protocol format is a bit complicated, and it's easy to make mistakes.There is no standard way to develop Telegraf plugins in Python. Maintaining a lot of plugins designed in different ways becomes hell.SolutionTelegraf_pyplug is a free and open-source software library to simplify and standardize the development of python input plugins for the Telegraf.UsageOne field:fromtelegraf_pyplug.mainimportprint_influxdb_formatMETRIC_NAME:str='jumping_sheep'METRIC_COUNT:int=321defmain()->None:print_influxdb_format(measurement=METRIC_NAME,fields={'count':METRIC_COUNT})if__name__=='__main__':main()Outputs:jumping_sheep count=321add_timestampargument:fromtelegraf_pyplug.mainimportprint_influxdb_formatMETRIC_NAME:str='jumping_sheep'METRIC_COUNT:int=321defmain()->None:print_influxdb_format(measurement=METRIC_NAME,fields={'count':METRIC_COUNT},add_timestamp=True)if__name__=='__main__':main()Outputs:jumping_sheep count=321 1599846911207090944One field, One tag:fromtelegraf_pyplug.mainimportprint_influxdb_formatMETRIC_NAME:str='jumping_sheep'METRIC_COUNT:int=321METRIC_COLOR:str='white'defmain()->None:print_influxdb_format(measurement=METRIC_NAME,tags={'color':METRIC_COLOR},fields={'count':METRIC_COUNT})if__name__=='__main__':main()Outputs:jumping_sheep,color=white count=321Multiple fields and tags,nano_timestampargument:fromdatetimeimportdatetimefromtypingimportDictfromtelegraf_pyplug.mainimportprint_influxdb_format,datetime_tzinfo_to_nano_unix_timestampMETRIC_NAME:str='jumping_sheep'METRIC_FIELDS:Dict[str,int]={'count':321,'height_m':1.5}METRIC_TAGS:Dict[str,str]={'color':'white','name':'sweater'}METRIC_DATE:str='01.01.2020 03:00:00+0300'defmain()->None:date:datetime=datetime.strptime(METRIC_DATE,'%d.%m.%Y %H:%M:%S%z')print_influxdb_format(measurement=METRIC_NAME,tags=METRIC_TAGS,fields=METRIC_FIELDS,nano_timestamp=datetime_tzinfo_to_nano_unix_timestamp(date))if__name__=='__main__':main()Outputs:jumping_sheep,color=white,name=sweater count=321,height_m=1.5 1577836800000000000More advanced examples can be found in theexamples_dir.InstallationTelegraf_PyPlugcan easily be installed with pip.Mac/Linuxpipinstall--upgradetelegraf_pyplugWindowspython-mpipinstall--upgradetelegraf_pyplugLicenseTelegraf_PyPlugis under MIT license.
See theLICENSE filefor the full license text.
Package: telegraf-xiaomi-air-purifier
telegraf-xiaomi-air-purifierTelegraf plugin for the Xiaomi Air Purifier (supports versions: 2, 2pro, 2s)
For 2s version you have to provide--tokenoptionRequirementsDevice have to be accesable (in the same network)You have to have the python in at least 3.5 versionInstallation$pipinstalltelegraf-xiaomi-air-purifierUsage$telegraf-xiaomi-air-purifier--ipDEVICE_IP_ADDRESSExample telegraf configuration[[inputs.exec]]commands=["telegraf-xiaomi-air-purifier --ip DEVICE_IP_ADDRESS"]data_format="influx"[inputs.exec.tags]location=bedroomLicenseSeeLICENSEfile.
Package: telegram2rss
telegram2rssA python library to fetch data from public Telegram channels to use them as a python object or RSS feed.InstallationFrom the git repogitclonehttps://github.com/zer0-x/python-telegram2rss.gitcdpython-telegram2rss

python3setup.pyinstallIt is recommended to use a virtual environment.pypipython3-mpipinstalltelegram2rssIt is recommended to use a virtual environment.AURNot available yet...UsageFetch to pythonimporttelegram2rsschannel_id="telegramtips"channel=telegram2rss.TGChannel(channel_id)number_of_pages=3messages=channel.fetch_to_python(number_of_pages)# Get some data about the channel after the fetchprint(channel.channel_subscribers_count)print(channel.channel_title)# You can also fetch again beginning from the last positionmessages2=channel.fetch_to_python(number_of_pages)Using a tor or any other proxyimporttelegram2rssimportrequestschannel_id="example"s=requests.Session()s.proxies={'http':"socks5://127.0.0.1:9050",'https':"socks5://127.0.0.1:9050"}channel=telegram2rss.TGChannel(channel_id,session_object=s)WarningImages will be included as links, so they will not be proxied unless you are using a proxy in your RSS reader.
Anyway there is a plan to implement a way to download them and included them as bash64 rather then links.Fetch toRSSimporttelegram2rsschannel_id="example"channel=telegram2rss.TGChannel("telegramtips")rss=messages=channel.fetch_to_python(3)# Decode the text then write it to a rss file:withopen("telegramtips_feed.rss","w")asf:f.writelines(rss.docode()Some rss readers support reading from a file with a uri like:file:////path/to/telegramtips_feed.rssYou can create a cron job or a systemd timer to run a script every while to update the file.Creating aflaskweb app"""A simple web app to create RSS feed from a telegram channel."""fromflaskimportFlaskfromflaskimportrequestimporttelegram2rssapp=Flask(__name__)@app.route('/<channel_id>',methods=['GET'])deffeed(channel_id):"""Create a channel object then fetch data to rss and return it."""channel=telegram2rss.TGChannel(channel_id)returnchannel.fetch_to_rss(int(request.args.get("pages"))or1).decode()if__name__=='__main__':app.run()Now you can usehttp://127.0.0.1:5000/<channel_id>?pages=<number_or_pages_to_fetch>in you RSS reader.
Package: telegram-anal
Telegram analysis ✨Telegram analysis is a python package that helps you have fun and make sense of different chat data you have.
Based on pyrogram, its mission is to help you have fun with Telegram and it's functions.
Whether it is about playing with your group chat dialogs or analysing the group dynamic of your business, personal chats or even your saved messages.Be creative and build on top of ready solutions! 🧠Current functionality (version 0.1.1):✨🌠wordcloud_json()Create fun wordclouds out of chats💬🗣who_breaks_silence_json()Analyze who tends to break the silence in the chats and write first🤍❤measure_top_reactions()measure who's messages are most reacted to and choose specific reactions!Installation:pip install telegram-anal🛠 Setup:This library uses Pyrogram for handling Telegram, so you will need to authenticate standardly by:Create an app and copy your api_id and api_hash fromhttps://my.telegram.org/Example:importasynciofromtelenal.clientimportClientfromtelenal.reactionsimportmeasure_top_reactionsfromtelenal.teleplotterimportplot_bars_from_dictasyncdefmain():client=Client("my_account","your_api_id","your_api_hash")tops=awaitmeasure_top_reactions(client,chat_name="Family chat :)",search_emojis=["😁","💪","👍"],)plot_bars_from_dict(tops)# <-- get a bar chart out of the boxif__name__=="__main__":asyncio.run(main())The library is newly born and needs creative and energetic support. Feel free to contribute!Ideas for future functionality:Analyze your activity based on sent chatting to identify your chatting patternsSave messages deleted by someone that texted you and save the secret they wanted to hideMeasure user profiles to identify persons' most popular tones (NLP may be needed)Predict when a user is prone to leave a community based on real cases (ML)Remember to have fun! :)This software is made purely for fun. Any illegal or amoral misuse of the software does not make the authors responsible for the consequences.Yours,
Vlad Bilyk