Saravanan666/pypi-org huggingface dataset:
Package: telegram-webapp-auth
telegram-webapp-authThis Python package implementsTelegram Web authentication algorithm.DocumentationSmall package - small documentation:)ExamplesUsing with FastAPILet's create some useful stuff accordingOAuth2 tutorial.Fileutils.py:fromtelegram_webapp_authimportparse_user_data,parse_init_data,validatefromfastapiimportHTTPException,Dependsfromfastapi.security.httpimportHTTPBase,HTTPAuthorizationCredentialsfrompydanticimportBaseModelfrom.configimportTelegramBotSettings# Telegram Bot configurationtelegram_authentication_schema=HTTPBase()classTelegramUser(BaseModel):id:intfirst_name:strlast_name:strusername:strlanguage_code:strdefverify_token(auth_cred:HTTPAuthorizationCredentials)->TelegramUser:settings=TelegramBotSettings()init_data=auth_cred.credentialstry:ifvalidate(init_data,settings.secret_key):# generated using generate_secret_key functionraiseValueError("Invalid hash")exceptValueError:raiseHTTPException(status_code=403,detail="Could not validate credentials")init_data=parse_init_data(init_data)user_data=parse_user_data(init_data["user"])returnTelegramUser.parse_obj(user_data)defget_current_user(auth_cred:HTTPAuthorizationCredentials=Depends(telegram_authentication_schema))->TelegramUser:returnverify_token(auth_cred)Finally, we can use it as usual.Fileapp.py:frompydanticimportBaseModelfromfastapiimportFastAPI,Dependsfromutilsimportget_current_user,TelegramUserapp=FastAPI()classMessage(BaseModel):text:str@app.post("/message")asyncdefsend_message(message:Message,user:TelegramUser=Depends(get_current_user),):"""Some backend logic..."""...
Package: telegraph
TelegraphPython Telegraph API wrapperDocumentation$python3-mpipinstalltelegraph# with asyncio support$python3-mpipinstall'telegraph[aio]'ExamplefromtelegraphimportTelegraphtelegraph=Telegraph()telegraph.create_account(short_name='1337')response=telegraph.create_page('Hey',html_content='<p>Hello, world!</p>')print(response['url'])Async Exampleimportasynciofromtelegraph.aioimportTelegraphasyncdefmain():telegraph=Telegraph()print(awaittelegraph.create_account(short_name='1337'))response=awaittelegraph.create_page('Hey',html_content='<p>Hello, world!</p>',)print(response['url'])asyncio.run(main())
Package: telegraph-api
TelegraphAPIAsynchronus Python wrapper for telgra.phAPIInstallationUse the package managerpipto install telegraph_api.pipinstalltelegraph-apiDocumentationYou can read documentation of this package onreadthedocsDocumentation of original REST api can be found ontelegra.phsiteFeaturesAsynchronousHTML2Nodes convertationFile uploadingBuilt with PydanticDocumentation is providedUsage# Importing required packagefromtelegraph_apiimportTelegraphimportasyncio# Declaring asynchronous function for using awaitasyncdefmain():# Creating new Telegraph objecttelegraph=Telegraph()# Creating new accountawaittelegraph.create_account("My Favourite Blog",author_name="Ivan")# Creating new pagenew_page=awaittelegraph.create_page("My first Telegraph Post",content_html="<p>Hello world!</p>"# Html content can be presented)# Printing page url into consoleprint(new_page.url)# Running asynchronous functionasyncio.run(main())ContributingPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.Please make sure to update tests as appropriate.LicenseI choosedMITlicenseArticle in my blog about writing this wrapper (On Russian) -https://blog.rteam.club/all/fromegeya2telegram-1/
Package: telegraph_commander
# telegraph_commanderTelegram simple bot framework## 1. First, extend BaseBot class, and provide router and configuration:```pythonfrom telegraph_commander.logger import get_console_handlerfrom telegraph_commander.bot import BaseBotfrom telegraph_commander.command import CommandRouter, BotCommandfrom telegraph_commander.config import BotConfigclass YourBotConfig(BotConfig):TELEGRAM_API_KEY = '<api_key>'DEFAULT_COMMAND = 'menu'class YourBot(BaseBot):router_class = CommandRouterconfig_class = YourBotConfigbot = YourBot()```## 2. Bind commands to router :```python@bot.router.command('menu')class MenuCommand(BotCommand):async def run(self):await self.telegram_api.send_message(self.chat_id, 'Select action', variants=[['/mul']])@bot.router.command('mul')class MulCommand(BotCommand):PARAMS = (dict(name='operand_1', title='first argument'),dict(name='operand_2', title='second argument'))async def run_handle(self):result = float(self.operand_1) * float(self.operand_2)await self.telegram_api.send_message(self.chat_id, 'result: {}'.format(result))```## 3. Add console logger handler(optional), and run your bot:```pythonbot.logger.addHandler(get_console_handler())bot.run()```
Package: telegraphy
TelegraphyTelegraphy provides real time events for WSGI Python applications with additional
features such as event filtering, subscription persistence and authorization/authentication.It’s initially intended for Django but you can extend it to any WSGI framework.WebSocket pub/sub and RPC is based onAutobahnPythonimplementation ofWAMP protocolGetting ItYou can getTelegraphyby using pip:$ pip install telegraphyYou will need to have pip installed on your system. On linux install the python-pip package,
on windows followthis.
Also, if you are on linux and not working with a virtualenv, remember to usesudofor both commands (sudo pip install telegraphy).If you want to install it from source, grab the git repository from GitHub and run setup.py:$ git clone git://github.com/machinalis/telegraphy/telegraphy.git
$ cd telegraphy
$ python setup.py installInstalling the Django appTelegraphy’s Django app is installed with the standard procedure:  in your projectssettings.pyfile
addtelegraphy.contrib.django_telegraphyto theINSTALLED_APPS:INSTALLED_APPS = (
    ...
    'telegraphy.contrib.django_telegraphy',
    ...
)Using ItThe django_telegraphy app allows you to easily extend your models so that they generate events
on creation, update or delete. Those events will reach your front end in real time.Simply install the django_telegraphy app in your Django project. Then run the following command
in parallel to your web-server:$ python manage.py run_telegraphExtend your models so that they automatically generate events: create anevents.pyfile next to yourmodels.pyfrommodelsimportMyModelfromtelegraphy.contrib.django_telegraphy.eventsimportBaseEventModelclassMyEventsModel(BaseEventModel):model=MyModelAnd that’s it! Every time you create, update or delete an instance of your model, an event will reach the frontend.You can find moreexamples in the documentation.More detailed documentationYou can read the docs onlinehere.
Or for offline access, you can clone the project code repository and read them from thedocsfolder.Help and discussionFor help, suggestions and discussions please refer tohttp://groups.google.com/group/telegraphyTo guide the development efforts, or if you find any bugs, please useGitHub’s issue tracker.AuthorsMany people you can find on thecontributors section.Special acknowledgements toMachinalisfor the time provided to work on this project.Machinalis also works on some other very interesting projects, likeSimpleAI,Quepyandmore.
Package: telegrapy
TelegrapyTelegrapy is a package for easy building of bots using theTelegram Bot API.How to startInstall package using pip$ pip3 install telegrapyALTERNATIVE: Clone the repo$ cd PATH_OF_YOUR_CHOICE
$ git clone https://github.com/sudogene/telegrapy.git
$ cd telegrapyTest your bot's account using the following codefrom telegrapy import Bot

token = 'YOUR_TOKEN'
bot = Bot(token)

print(bot.get_me())Set bot to run in a loop and keep program alivebot.run()
print('Running...')

while True:
  time.sleep(3)When the bot runs, it indefinitely checks for message updates and handles them.Quick example on an echo bot can be found inexample.py.Telegram ObjectsTelegram Objects in telegrapy are object-oriented implementation ofJSON-objectsin the Telegram API. Each object has a unique identifier (ID) and its corresponding JSON. Hence, any object can return its own JSON format by calling the.jsonattribute.UserBased on TelegramUser. These are typically senders ofMessage.ChatBased on TelegramChat. They are subclassed intoPrivateChat,GroupChat, andSupergroupChat. As of now, there are not many differences in terms of parsing messages from these chat types. Chat IDs are required for bots to send messages to.MessageBased on TelegramMessage. The main bulk of data necessary for bot interactions. Contains information of the date time, sender, chat, command, and text.Creating Bot CommandsBot commands are special text/phrases recognized by bots as commands, and trigger bots to call functions defined by the user. All messages received by the bot are parsed and handled by theHandlerclass which is attached to the Bot upon creation. You can create your handler functions using the function signaturedef function_name(msg: telegrapy.Message)where all functions MUST take in theMessageobject. A code example:def echo(msg):
  chat_id = msg.chat_id
  text = msg.text
  bot.send_message(chat_id, text)Defined handler functions can then be added to the bot's handler:# get the handelr
handler = bot.handler

# add the function
handler.add_command('echo', echo)Adding of commands to the handler requires two arguments; the string command and the function.Bot MethodsNot to be confused with bot commands. Bot methods are GET and POST HTTP methods based on TelegramAvailable Methods. As of now, the following methods have been implemented in this library:Methodtelegrapy.Bot functiongetMeget_mesendMessagesend_messagesendPhotosend_photosendAudiosend_audiosendDocumentsend_documentsendVideosend_videosendVoicesend_voicesendDicesend_diceOptional Arguments for Bot MethodsSome methods support additional arguments specific to use case. An example isreply_to_message_idwhich allows the bot's message to reply to a specific message. This requires the Message ID, which is conveniently available in theMessageinput for all handler functions.# Direct reply to the sender's message
def echo(msg):
  chat_id = msg.chat_id
  text = msg.text
  bot.send_message(chat_id, text, reply_to_message_id=msg.id)

bot.handler.add_command('echo', echo)... More to be added
Package: telegrask
TelegraskFlask-inspired Telegram bot micro framework for Python.
Main idea is to use callback function decorators and make bot
creating more intuitive for developer.Installing$python3-mpipinstallTelegraskSimple "Hello World" bot examplefromtelegraskimportTelegraskbot=Telegrask("BOT_TOKEN")@bot.command("hello",help='display "Hello, World!"')defhello_command(update,context):update.message.reply_text("Hello, World!")if__name__=="__main__":bot.run(debug=True)More examples inexamplesfolder.Equivalent in purepython-telegram-botClick to showfromtelegram.extimportUpdater,CommandHandlerfromtelegramimportParseModeimportlogginglogging.basicConfig(format="%(levelname)s-%(message)s",level=logging.DEBUG)logger=logging.getLogger(__name__)defhello_command(update,context):update.message.reply_text("Hello, World!")defhelp_command(update,context):help_content="""*Available commands*/hellodisplay "Hello, World!"/helpdisplay this message"""update.message.reply_text(help_content,parse_mode=ParseMode.MARKDOWN)defmain():globalupdaterupdater=Updater("BOT_TOKEN")dispatcher=updater.dispatcherdispatcher.add_handler(CommandHandler("hello",hello_command))dispatcher.add_handler(CommandHandler(["help","start"],help_command))updater.start_polling()updater.idle()if__name__=="__main__":main()Useful linksDocumentationPyPI Releases
Package: telegrinder-templating
telegrinder templating toolThis module is used with telegrinder framework. It is used to create text templates.Install using PyPI:pip install telegrinder-templatingDocumentationThere is templating in order to avoid using large text. Moduletelegrinder_templatinghas anABCTemplatinginterface for creating templating classes.fromtelegrinder_templatingimportABCTemplatingtelegrinder_templatinghas classJinjaTemplatingto work with jinja templates.fromtelegrinder_templatingimportJinjaTemplatingJinjaTemplatingmethods:render(template_name: str, **data: Any) -> strrender_from_string(template_source: str, **data: Any) -> str@add_filter(key: str | None) -> wrapper(func: JinjaFilter)Example:importasyncioimportpathlibimportjinja2fromtelegrinder_templatingimportJinjaTemplatingjt=JinjaTemplating(pathlib.Path(__file__).resolve().parent/"templates")@jt.add_filter("title")deftitle_string(value:str,must_strip:bool=False)->str:ifmust_strip:returnvalue.strip().title()returnvalue.title()asyncdefmain():awaitjt.render("template.j2",digits=[1,2,3])awaitjt.render_from_string("{{ name|title(must_strip=True) }}",name="  alex")asyncio.run(main())More details aboutJinjacan be foundHERE
Package: teleinfo
python-teleinfoRead and parse teleinfo data from France EDF electricity providerBuild:Unit tests:package:Lors de l'installation, un outil CLI est installé :bin/teleinfo_jsonUsageUsage du module :from teleinfo import Parser
  from teleinfo.hw_vendors import RpiDom
  ti = Parser(RpiDom())
  print ti.get_frame()Le parseur supporte aussi l'itération :from teleinfo import Parser
  from teleinfo.hw_vendors import RpiDom
  for frame in Parser(RpiDom()):
      do_something_with(frame)Supported DevicesRpiDomSolarBox_USBuTeleinfo USB Dongle from Charles Hallard (https://www.tindie.com/products/hallard/micro-teleinfo-v20/)PITinfo Raspberry PI hat from Charles Hallard (https://www.tindie.com/products/hallard/pitinfo/)Example>>> import teleinfo
>>> from teleinfo import Parser
>>> from teleinfo.hw_vendors import UTInfo2
>>> ti = Parser(UTInfo2())
>>> ti.get_frame()

{'PPOT': '00', 'MOTDETAT': '000000', 'OPTARIF': 'HC..', 'IMAX3': '060', 'IMAX1': '060', 'ADCO': '021876647540', 'HCHC': '002234766', 'PAPP': '08490', 'HHPHC': 'A', 'IINST1': '010', 'IMAX2': '060', 'IINST3': '016', 'IINST2': '008', 'PTEC': 'HP..', 'ISOUSC': '20', 'PMAX': '11690', 'HCHP': '011085557'}

>>> for frame in Parser(UTInfo2()):
...     print frame
...Appel avec changement de port (ici/dev/ttyUSB0) pour un module Micro Teleinfo#!/usr/bin/env pythonfromteleinfoimportParserfromteleinfo.hw_vendorsimportUTInfo2ti=Parser(UTInfo2(port="/dev/ttyUSB0"))printti.get_frame()Script avec changement de vitesse (ici9600) pour un module PITInfo en mode standard sur un Linky#!/usr/bin/env pythonfromteleinfoimportParserfromteleinfo.hw_vendorsimportPITInfoti=Parser(PITInfo(baudrate=9600))printti.get_frame()
Package: teleinfo-exporter
Teleinfo ExporterSimple prometheus exporter for Linky teleinfo.
Teleinfo Tasmota project :https://github.com/NicolasBernaerts/tasmota/tree/master/teleinfoGrafana Dashboard:https://grafana.com/grafana/dashboards/20182-linky-teleinfo/InstallationPippython3 -m pip install teleinfo-exporter
teleinfo-exporter --helpDockerMinimal Docker compose:services:web:image:ghcr.io/d3vyce/teleinfo-exporter:latestenvironment:-BROKER_HOSTNAME=10.10.0.10ports:-8000:8000restart:alwaysArchitecturesArchitectureAvailableTagx86-64✅amd64-<version tag>arm64✅arm64-<version tag>Version TagsTagAvailableDescriptionlatest✅Latest versionVariablesArgumentVariableDescriptionDefault--http_port-e HTTP_PORTHTTP Port8000--auth_user-e AUTH_USERBasic Auth User--auth_hash-e AUTH_HASHBasic Auth Hash--http_cert-e HTTP_CERTHTTP Certificate--http_key-e HTTP_KEYHTTP Key--broker_host-e BROKER_HOSTMQTT Host--broker_port-e BROKER_PORTMQTT Port1883--broker_user-e BROKER_USERMQTT User--broker_password-e BROKER_PASSWORDMQTT Password--broker_topic-e BROKER_TOPICTeleinfo Topicteleinfo/tele/SENSORConfigurationHTTP AuthenticationTo generate the password hash use the following command:htpasswd-bnBC10""PASSWORD|tr-d':'PrometheusConfig example:scrape_configs:-job_name:'Teleinfo'scheme:httpstls_config:ca_file:teleinfo.crtbasic_auth:username:USERpassword:PASSWORDstatic_configs:-targets:-192.168.1.2:8000
Package: teleirc
TeleIRC - IRC<->telegram gatewayNot my best proyect name, I know.WarningThis is a 3h project. I actually invested
3h in writting it all (except this readme,
of course).
It works, but it’ll probably lack things
you wantThis project is a telegram to irc gateway (and vice-versa)
similar bitlbee + libpurple + telegram-purple setup.After a few hours trying to make bitlbee + telegram-libpurple
to work on my rpi3, I decided that writing my own would probably
be easier (and it actually was).Currently, you need to have telegram-cli installed, and
the user authenticated. Only one user per system user is allowed
at a time, and probably port collision will happen if you do it
on multiple users (irc port is hardcoded, as well as default
port for telegram-cli in pytg).UsageUsage is pretty simple:Install telegram_cliRun telegram_cli and authenticate your userRunteleircConnect your irc server to localhost:6666 and join #telegram
channelNow, you’ll see some users have a # before their names on the
#telegram channel. That’s so you can use autocomplete on
/join to not miss the channels name, but they’re not actually
users and talking to them directly from the #telegram channel
will probably work not-so-fine.Also, I’d recommend not using #telegram channel at all except
for the userlist, as user responses will always go on private
queries…Apart from that, joining, querying and receiving messages work
as usual on IRC
Package: telejson-installer
Python Telejson installerInstall Telejson eaisily for Python projects.InstallationInstalling from Pypi:pip install telejsonInstalling latest Hg version:pip install -e hg+https://Nekmo@bitbucket.org/Nekmo/python-telejson#egg=telejsonPlease read the documentation for Pytg2.https://bitbucket.org/luckydonald/pytg2/overviewTelejson website:https://bitbucket.org/luckydonald/tg-for-pytg2.git
Package: telekey
Telekey - The Telegram Bot Api SupplementsTelekeyis some Tools to develop a telegram bot easier than before.
you can use telekey alongsidepython-telegram-botInstallationYou can install the Telekey usingPyPI:pip install telekeyAnd you can create new project like this:telekey newbot <project_name>
cd <project_name>How to useYou can use the telekey tools in your own project.learn from example.
Package: telelib
TeleLibA Telegram Library that uses Python to generate Wrappers on Any language you like :)Usageinstallationpipinstalltelelibor if you're on nodenpminstall@TeleLib/TeleLib# ORyarnadd@TeleLib/TeleLibmore infofor more examples visitexamplesfor better and more detailed documentation visitdocsissues / bugs / suggestions ?fix it and open a Pull request :)don't forget to follow ourcontribution rulescontributorsReloadLife- MaintainerYour name can be here :)known bugsfix workflow to publish codes to pypi.fix workflow to publish codes on npm.todo listWrite Code that write code for methods and types.Write Full Documentationadd Helper methodsAdd More examplesWrite Interfaces for all Message types, classes, methods.Add Support for WebhooksImplement TelegramPassport related methodsAdd MTProto and TDLib Wrapper.Clean up and optimize the code.Supported LanguagesTypeScriptPythonPHPLuaRubyGoPerlJulia
Package: telelog
Tele Log算法引擎日志相关的toolkit, 是可支持k8s日志收集的 python package。how to commpilepythonsetup.pysdistbdist_wheelhow to releasetwineupload-rpypidist/*.whlhow to installpipinstallteleloghow to use# initial, in the main moduleimportloggingfromtelelogimportget_loggerlogger=logging.getLogger()logger=get_logger(logger)logger.info("hello main module")# in othre moduleimportlogginglogger=logging.getLogger(__name__)logger.info("hello other module")
Package: telemck
telemc-pyLibrary and client tools for accessing and recordingtelemdmonitoring data.CLIrunmake installandsource .venv/bin/activateinstall locally.% telemc --help
usage: telemc [-h] [--redis-host REDIS_HOST] [--redis-port REDIS_PORT]
              {list,info,pause,unpause,follow} ...

positional arguments:
  {list,info,pause,unpause,follow}
                        telemc command
    list                list nodes
    info                show node info
    pause               pause telemetry reporting
    unpause             start telemetry reporting
    follow              subscribe to the telemetry data

optional arguments:
  -h, --help            show this help message and exit
  --redis-host REDIS_HOST
                        redis host
  --redis-port REDIS_PORT
                        redis portLibraryUsage examplesPrint telemetry:importredisimporttelemcrds=redis.Redis(decode_responses=True)withtelemc.TelemetrySubscriber(rds)assub:forteleminsub:print(telem.timestamp,telem.node,...)Or use the higher-levelTelemetryRecorder, which is a thread and can be extended to implement various recording
tools.importtelemcrecorder=telemc.recorder.TelemetryPrinter(rds)recorder.start()Pause all telemetry daemonsctrl=telemc.TelemetryController(rds)ctrl.pause_all()
Package: teleme
Teleme(pronouncedtell-me)  is an async, super simple Telegram Bot framework.Under DevelopmentWhilst the code has been used for years privately, since I just released the code,
there may have been some bugs that have left undiscovered. I have decided to set
the status of this project as Beta.LicenseCopyright 2020 Kaede HoshikawaLicensed under the Apache License, Version 2.0 (the “License”);
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Package: telemeter
Telenet Telemeter parserAboutThis program queries the 'Mijn Telenet' site to retrieve data about a user's monthly Telenet internet usage (a.k.a. telemeter).It uses Selenium to fetch the necessary cookies, please make sure you have Firefox and the Gecko driver installed.
The cookies are cached so subsequent calls will be much faster.UPDATE: Version 3.0 no longer uses Selenium.Can be run as a standalone script or used as a module.
As a standalone script it prints telemeter info to the console. Credentials can be provided via environment variables (TELENET_USERNAME, TELENET_PASSWORD), else the user will be prompted for credentials.InstallationpipinstalltelemeterUsageAs moduleimporttelemetertelenet_session=telemeter.TelenetSession()telenet_session.login("my_username","my_password")my_telemeter=telenet_session.telemeter()As scriptpython3telemeter/telemeter.py
Package: telemetrix
The Telemetrix ProjectThe Telemetrix Project is a modern-day replacement for
Arduino StandardFirmata, equipped with many more built-in features than
StandardFirmata.Here is a feature comparison between Telemetrix and StandardFirmata:FeatureTelemetrixStandardFirmataAnalog InputXXAnalog Output (PWM)XXDigital InputXXDigital OutputXXi2c PrimitivesXXServo Motor ControlXXDHT Temperature/Humidity SensorXOneWire PrimitivesXHC-SR04 Sonar Distance SensorXSPI PrimitivesXStepper Motor Control (AccelStepper)XPython Threaded Client IncludedXPython Asyncio Client IncludedXSupport For STM32 Boards (Black Pill)XDesigned To Be User ExtensibleXIntegrated Debugging Aids ProvidedXExamples For All FeaturesXThe project consists of aPython client APIused to create a Python
client
application and C++ servers that communicate with the Python client over a serial or WiFi link.This repository is the Python 3 client API.The server for Arduino serial linked devices is calledTelemetrix4Arduino.The WiFi server for ESP8266 devices is calledTelemetrix4Esp8266.AUser's Guideexplaining installation and use is available online.Historically, Telemetrix was developed in phases, and the directories for those phases
were left
intact for those interested in the project's beginnings. You may view a discussion of
these phases on theBots In Piecesblog.Programmed withPycharm