Saravanan666/pypi-org huggingface dataset:
Package: aio-tiny-healthcheck
aio_tiny_healthcheckTiny asynchronous implementation of healthcheck provider and serverInstallationpipinstallaio-tiny-healthcheckUsageBy default, the Checker returns 200 if all checks successfully finish or 500 in opposite case.Using with aiohttpfromaiohttpimportwebfromaio_tiny_healthcheck.checkerimportCheckerdefsome_sync_check():returnTrueasyncdefsome_async_check():returnFalsehealthcheck_provider=Checker()healthcheck_provider.add_check('sync_check_true',some_async_check)healthcheck_provider.add_check('async_check_false',some_async_check)app=web.Application()app.router.add_get('/healthcheck',healthcheck_provider.aiohttp_handler)web.run_app(app)Using with SanicfromsanicimportSanicfromsanic.responseimportjsonfromaio_tiny_healthcheck.checkerimportCheckerapp=Sanic()defsome_sync_check():returnTrueasyncdefsome_async_check():returnFalsehealthcheck_provider=Checker(success_code=201,fail_code=400)healthcheck_provider.add_check('sync_check_true',some_async_check)healthcheck_provider.add_check('async_check_false',some_async_check)@app.route("/healthcheck")asyncdeftest(request):hc_response=healthcheck_provider.check_handler()returnjson(hc_response.body,status=hc_response.code)if__name__=="__main__":app.run(host="0.0.0.0",port=8000)Using in concurrent modeYou should want to run healthcheck in background if you already have some blocking operation in your execution flow.
So, you can just use built-in server for this.fromaio_tiny_healthcheck.checkerimportCheckerfromaio_tiny_healthcheck.http_serverimportHttpServerimportasyncioasyncdefsome_long_task():awaitasyncio.sleep(3600)defsome_sync_check():returnTrueasyncdefsome_async_check():returnTrueaio_thc=Checker()hc_server=HttpServer(aio_thc,path='/health',host='localhost',port=9090)aio_thc.add_check('sync_check_true',some_async_check)aio_thc.add_check('async_check_false',some_async_check)asyncdefmain():# Run healthcheck concurrentlyasyncio.create_task(hc_server.run())# Run long taskawaitsome_long_task()if__name__=='__main__':loop=asyncio.get_event_loop()loop.run_until_complete(main())Utility for health checkingpython -m aio_tiny_healthcheck http://localhost:9192/healthcheckUseful for running health check without external dependencies like curl.By default, concurrent server and health checking utility are working
with a port and query pathhttp://localhost:8000/healthcheck.
So, if you run concurrent server with no using arguments, you can also run the utility
with without argumentspython -m aio_tiny_healthcheck.
Package: aiotk
PurposeThis is a collection of asyncio-related utilities that I have found useful,
that I’ve used in at least two projects and that seem like they might be useful
to others.ResourcesDocumentation:aiotk on ReadTheDocsOfficial releases:aiotk on PyPISource code:aiotk on GitHubContributingNobody is paid to maintain this software, but we welcome pull requests!LicenseLicensed under the very permissive MIT license for maximum usage.
Package: aiotkinter
This module provide an asyncio API for the the Tkinter event loopLicense: MIT (see LICENSE)RequirementsUnix platform (it doesn’t work on Windows because of the lack ofTcl_CreateFileHandleron this platform)Python 3.3 + asyncio or Python >= 3.4Installationpythonsetup.pyinstallUsageaiotkinterexpose an event loop policy (which based on the default
event loop policy ofasyncio) so the only thing you have to do is to
set the global event loop policy with an instance ofTkinterEventLoopPolicy:importasyncioimportaiotkinterasyncio.set_event_loop_policy(aiotkinter.TkinterEventLoopPolicy())loop=asyncio.get_event_loop()loop.run_forever()
Package: aiotnse
aioTNSEAsynchronous Python API forTNS-Energo.InstallationUse pip to install the library:pip install aiotnseUsageimportasynciofrompprintimportpprintimportaiohttpfromaiotnseimportSimpleTNSEAuth,TNSEApiasyncdefmain(account:str)->None:"""Create the aiohttp session and run the example."""asyncwithaiohttp.ClientSession()assession:auth=SimpleTNSEAuth(session)api=TNSEApi(auth)data=awaitapi.async_get_latest_readings(account)pprint(data)if__name__=="__main__":_account=string=str(input("Account: "))asyncio.run(main(_account))TheSimpleTNSEAuthclient also accept custom access token (this can be found by sniffing the client).This will return a price object that looks a little like this:{"STATUS":"Используется","counters":{"1111111":[{"Can_delete":"0","DatePok":"06.02.2023","DatePosledPover":"31.12.2021","DatePover":"31.12.2037","DatePoverStatus":0,"DatePoverURL":"","GodVipuska":"01.01.22","KoefTrans":"1","Label":"Дневная зона","MaxPok":"2000","MestoUst":"Жилой дом","ModelPU":"Нева МТ 114 AS PLRFPC","NazvanieTarifa":"День","NazvanieUslugi":"Электроснабжение ","NomerTarifa":"0","NomerUslugi":"0100","PredPok":"700","RaschSch":"Работает","Razradnost":"6","RowID":"1111111","Tarifnost":"2","Type":"1","ZavodNomer":"22222222","sort":0,"zakrPok":"700"},{"Can_delete":"0","DatePok":"06.02.2023","DatePosledPover":"31.12.2021","DatePover":"31.12.2037","DatePoverStatus":0,"DatePoverURL":"","GodVipuska":"01.01.22","KoefTrans":"1","Label":"Ночная зона","MaxPok":"2000","MestoUst":"Жилой дом","ModelPU":"Нева МТ 114 AS PLRFPC","NazvanieTarifa":"Ночь","NazvanieUslugi":"Электроснабжение ","NomerTarifa":"1","NomerUslugi":"0100","PredPok":"337","RaschSch":"Работает","Razradnost":"6","RowID":"1111111","Tarifnost":"2","Type":"1","ZavodNomer":"22222222","sort":1,"zakrPok":"337"}]},"result":true}Timeoutsaiotnse does not specify any timeouts for any requests. You will need to specify them in your own code. We recommend thetimeoutfromasynciopackage:importasynciowithasyncio.timeout(10):data=awaitapi.async_get_account_status(account)
Package: aiotodoist
aiotodoisttodoist APIwith async enabled usingaiohttp.ChangesTo enable asynchronous, there have plenty methods be changed to returnawaitableinstead, list below:APIapi._get,api_postwill be changed to returncoroutine.api.sync,api.commitwill be changed to returnfuture.ManagersAll of those managers could be accessed viaapi.<manager_name>.activity.getbackups.getbusiness_users.invite,business_users.accept_invitation, business_users.reject_invitation`completed.get_stats,completed.get_allemails.get_or_create,emails.disableitems.get_completedprojects.get_archived,projects.get_dataquick.addtemplates.import_into_project,templates.export_as_file,templates.exort_as_urluploads.add,uploads.get,uploads.deleteuser.delete,user.update_notification.settingMethods listed above, will returncoroutine, and others will returnFuture:collaborator_states.sync,collaborators.syncfilters.sync,filters.getinvitations.syncitems.synclabels.synclive_notifications.synclocations.syncnotes.syncproject_notes.syncprojects.syncreminders.syncsections.syncuser.sync
Package: aiotoolz
An async port of the wonderful pytoolz/toolz library.See the PyToolz documentation athttps://toolz.readthedocs.ioand the github page athttps://github.com/pytoolz/toolz.LICENSENew BSD. SeeLicense File.Installaiotoolzis not yet on the Python Package Index (PyPI), but soon you can install it like so:pip install aiotoolzCurrently, you can install it like so:pip install git+https://github.com/eabrouwer3/aiotoolz.gitStructure and Heritagetoolzis implemented in three parts:itertoolz, for operations on iterables. Examples:groupby,unique,interpose,functoolz, for higher-order functions. Examples:memoize,curry,compose,dicttoolz, for operations on dictionaries. Examples:assoc,update-in,merge.These functions come from the legacy of functional languages for list
processing. They interoperate well to accomplish common complex tasks.Read ourAPI
Documentationfor
more details.ExampleThis builds a standard wordcount function from pieces withintoolz:>>>defstem(word):...""" Stem word to primitive form """...returnword.lower().rstrip(",.!:;'-\"").lstrip("'\"")>>>fromtoolzimportcompose,frequencies,partial>>>fromtoolz.curriedimportmap>>>wordcount=compose(frequencies,map(stem),str.split)>>>sentence="This cat jumped over this other cat!">>>wordcount(sentence){'this':2,'cat':2,'jumped':1,'over':1,'other':1}Dependenciesaiotoolzsupports Python 3.5+ with a common codebase.
It is pure Python and requires no dependencies beyond the standard
library.It is, in short, a lightweight dependency.See AlsoUnderscore.js: A similar library for
JavaScriptEnumerable: A
similar library for RubyClojure: A functional language whose
standard library has several counterparts intoolzitertools: The
Python standard library for iterator toolsfunctools: The
Python standard library for function toolsContributions Welcomeaiotoolzaims to be a repository for utility functions, particularly
those that come from the functional programming and list processing
traditions. We welcome contributions that fall within this scope.We also try to keep the API small to keepaiotoolzmanageable.  The ideal
contribution is significantly different from existing functions and has
precedent in a few other functional systems.Please take a look at ourissue pagefor contribution ideas.CommunitySee ourtoolzmailing list.
We’re friendly.
Package: aiotorndb
torndbrewrite to asynchronousExampleFirst get a connection objectfromaiotorndbimportConnectionconn=Connection(host="127.0.0.1",db="test",user="root",password="123456",port=3306,time_zone="+8:00",charset="utf8",)Next, you can use methods such as select, update, insert, delete, etc.importasyncioasyncdeftest():get_result=awaitconn.get("select * from user where id = 1")print(get_result)# {'id': 1, 'name': 'tom'}select_result=awaitconn.select("select * from user")print(select_result)# [{'id': 1, 'name': 'tom'}, {'id': 2, 'name': 'ellis'}]update_result=awaitconn.update("update user set name =%(name)swhere id = 1",name="eddie")print(update_result)# 1insert_result=awaitconn.insert("insert into user (name) values (%(name)s)",name="dav")print(insert_result)# 3# sql = select * from user where id in (1, 3)select_result2=awaitconn.select("select * from user where id in%(user_ids)s",user_ids=[1,3])print(select_result2)# [{'id': 1, 'name': 'eddie'}, {'id': 3, 'name': 'dav'}]# sql = select * from project_tag where name like '%e%'select_result3=awaitconn.select("select * from project_tag where name like%(name)s",name="%e%")print(select_result3)# [{'id': 1, 'name': 'eddie'}, {'id': 2, 'name': 'ellis'}]asyncio.run(test())
Package: aiotp
aiotp - One-time password package in PythonInstallationpip install aiotpUsageTime-based OTPsimportasynciofromaiotpimportTOTPfromaiotpimportrandom_b32# from aiotp.sync import HOTP, TOTP, random_b32, random_hexasyncdefmain():key=awaitrandom_b32()asyncwithTOTP(key,digits=4,interval=5)astotp:code=awaittotp.create()result=awaittotp.verify(code)print(result)# -> Trueawaitasyncio.sleep(5)result=awaittotp.verify(code)print(result)# -> Falseasyncio.run(main())Counter-based OTPsimportasynciofromaiotpimportHOTPfromaiotpimportrandom_b32# from aiotp.sync import HOTP, TOTP, random_b32, random_hexasyncdefmain():key=awaitrandom_b32()asyncwithHOTP(key,digits=4)ashotp:code=awaithotp.create(1000)result=awaithotp.verify(code,1000)print(result)# -> Trueresult=awaithotp.verify(code,1001)print(result)# -> Falseasyncio.run(main())LinksPackage (PyPi)RFC 6238: TOTP (algorithm)RFC 4226: HOTP (algorithm)
Package: aiotplink
# aiotplinkLibrary to communicate with TP-Link Smart Plugs and similar devices## Features* Supports TPLink Smart Switches and Lights* Python API to interact with device at a low level using asyncio## About this libraryBased on the work done by [SoftSCheck](https://github.com/softScheck/tplink-smartplug)and [GadgetReactor](https://github.com/GadgetReactor/pyHS100)## Installation```$ sudo pip3 install aiotplink```At this point you should be able to useYou can try:```python3 -m aioyplink```And you should be able to turn On/Off your devices## Using the library.To make things simple, you create a class with 2 methods, "register" and "unregister"class devices():""" A simple class with a register and  unregister methods"""def __init__(self):self.devices={}self.doi=None #device of interestdef register(self,info, addr):if "mac" in info and info["mac"].lower() not in self.devices:self.devices[info["mac"].lower()] = aiot.GetDevice(addr,info,hb=10)else:self.devices[info["mac"].lower()].addr = addrdef unregister(self,mac):if mac.lower() in self.devices:print ("%s is gone"% self.devices[mac.lower()].name)self.devices[mac.lower()].stop()del(self.devices[mac.lower()])def stop(self):for dev in self.devices.values():dev.stop()When registering, you get an dictionary with the flatten out info from a TP-Link device, and an address withthe format (ip address, port). You can pass those information directly to 'GetDevice' to get the correct object.'GetDevice" is defined like soGetDevice(addr,info,hb=HBTIMEOUT,on_change=lambda x: print(x))With addr, the address pair, info, the flatten out informaton from discovery, hb, a heatbeat timeout in secs andon_change a function that will react to whatever is produced by the heartbeat. Note that if the device has an energy meter,those values will automatically be produced with the heartbeat.After that it is quite simple.MyDevices= devices()loop = aio.get_event_loop()discovery = aiot.TPLinkDiscovery(loop, MyDevices, repeat=15)try:loop.add_reader(sys.stdin,readin)discovery.start()print("Hit \"Enter\" to start")print("Use Ctrl-C to quit")loop.run_forever()except:print("Exiting at user's request.")finally:MyDevices.stop()discovery.cleanup()loop.remove_reader(sys.stdin)loop.run_until_complete(aio.sleep(10))loop.close()Create a registrar instanceCreate a TPLinkDiscovery instance passing the registrar and how often to run discoveryStart discovery, and you are on your merry way.The various device object will have these methods available.on(): Turning the device onoff(): Turning the device offled_on(): Turn the LED light on (AKA "Night mode" off)led_off : Turn the LED light off (AKA "Night mode" on)set_name(name)set_brighness)set_temperature()set_colour(hue, saturation, value)depending on their capabilities.Most commands are defined in the commands.py file.## TroubleshootingOpen an issue and I'll try to help.
Package: aiotr
aiotrThe transmission python client with asyncio supportsimple usageadd a torrentimportasynciofrompprintimportpprintimportujsonfromaiotrimportTransmissionClientasyncdefmain():client=TransmissionClient(loads=ujson.loads,dumps=ujson.dumps)# client.host="xxx" needed when verify is enabledpprint(awaitclient.port_test())data=awaitclient.torrent_add(filename="magnet:?xt=urn:btih:091e5c8b3b3f4c4fac68c0867b4c5740365d79fb&dn=%5B210730%5D%5B%E9%88%B4%E6%9C%A8%E3%81%BF%E3%82%89%E4%B9%83%5D%E3%83%88%E3%82%A4%E3%83%AC%E3%81%AE%E8%8A%B1%E5%AD%90%E3%81%95%E3%82%93VS%E5%B1%88%E5%BC%B7%E9%80%80%E9%AD%94%E5%B8%AB%20%EF%BD%9E%E6%82%AA%E5%A0%95%E3%81%A1%E3%83%9E%E2%97%8B%E3%82%B3%E3%81%AB%E5%A4%A9%E8%AA%85%E3%82%B6%E3%83%BC%E3%83%A1%E3%83%B3%E9%80%A3%E7%B6%9A%E4%B8%AD%E5%87%BA%E3%81%97%EF%BD%9E%20%E7%AC%AC%E4%B8%89%E6%80%AA%EF%BC%88%E3%81%A0%E3%81%84%E3%81%95%E3%82%93%E3%81%8B%E3%81%84%EF%BC%89%20%E6%88%A6%E6%85%84%E3%80%8E%E4%BA%BA%E9%9D%A2%E7%8A%AC%E3%80%8F%EF%BC%81%E5%81%A5%E5%BA%B7%E5%84%AA%E8%89%AF%E7%8A%AC%E8%80%B3%E2%97%8B%E5%A5%B3%E3%81%AB%E5%88%9D%E3%82%81%E3%81%A6%E3%81%AE%E6%80%A7%E6%95%99%E8%82%B2%28No%20Watermark%29.mp4&tr=http%3A%2F%2Fsukebei.tracker.wf%3A8888%2Fannounce&tr=udp%3A%2F%2Fopen.stealth.si%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969%2Fannounce&tr=udp%3A%2F%2Fexodus.desync.com%3A6969%2Fannounce")pprint(data)asyncio.run(main())Rpc methods are listedhere
Package: aiotraceroute
Simple asynchronous tracerouteDead simple module which provides asynchronous traceroute with asynchronous dns resolution.Needs root privileges to be executed (for raw socket)Installationpip install aiotracerouteExampleimportasynciofromaiotracerouteimportaiotracerouteasyncdefmain(dest):# print hop by hopasyncforn,addr,hostinaiotraceroute(dest):print(n,addr,host)# Or run it without iteratingtr=aiotraceroute(dest)result=awaittr.run()print(result)asyncio.get_event_loop().run_until_complete(main("google.com"))APITheaiotraceroutefunction takes the following arguments:dest: Traceroute destination, can either be a hostname or an IP address.port: Destination port (optionnal, default: 33434)max_hops: Maximum number of hops before reaching final destination (optionnal, default: 30)timeout: Timeout between each hop (optionnal: default: 1s)packet_size: Pakcte size in bytes to send each time (optionnal: default: 60)Therun()method runs the traceroute and returns a list of tuples containing hop_number, address or None, hostname or NonePython versionsPython >= 3.6 are supportedTestsThis project usesunittest.
Runmake initthensudo make test
Package: aiotractive
aiotractiveUnofficialAsynchronous Python client for theTractiveREST API.This project and it's author are not affilated with Tractive GmbHThis project is a result of reverse engineering of the Tractive web app.Inspired byhome_assistant_tractive.Initially some code was borrowed from home_assistant_tractive, but in the end all of it was replaced with my own implementations.The package is in active development.Not all features available in the Tractive web app are implemented.Important notes:In order to use Tractive devices and their service you need to have an active subscription.Tractive may change their API at any point of time and this project will be broken. Please, report any issues.Installationpip install aiotractiveUsageimportasynciofromaiotractiveimportTractiveasyncdefmain():asyncwithTractive("email","password")asclient:# interact with the client herepassif__name__=="__main__":asyncio.run(main())TractiveTractive is the entrypoint class, it acts as an async context manager and provides access to API endpoints.Authenticationclient.authenticate()# {'user_id': 'user_id', 'client_id': 'client_id', 'expires_at': 1626821491, 'access_token': 'long access token'}Trackerstrackers=awaitclient.trackers()tracker=trackers[0]# Ortracker=client.tracker("TRACKER_ID")# Retrieve detailsawaittrackers.details()# Includes device capabilities, battery status(not level), charging state and so onawaittracker.hw_info()# Includes battery level, firmware version, model and so on# Retrieve current locationawaittracker.pos_report()# Includes coordinates, latitude, speed and so on# Retrieve hardware info# Retrive history positions```pythonnow=datetime.timestamp(datetime.now())time_from=now-3600*LAST_HOURStime_to=nowformat=json_segmentsawaittracker.positions(time_from,time_to,format):Control the buzzerawait set_buzzer_active(True) # or FalseControl the LEDawait set_led_active(True) # or FalseControl the live trackingawait set_live_tracking_active(True) # or False#### Trackable objects (usually pets)
```python
objects = await client.trackable_objects()

object = objects[0]

# Retrieve details
await object.details() # Includes pet's name, pet's tracker id and so onEventsasyncforeventinclient.events():pp(event)After connecting you will immediately receive onetracker_statusevent per owned tracker.
The first event always includes full current status of the tracker including current position, battery level, states of the buzzer,
the LED and the live tracking.All following events will have the same name, but only include one of these: either a position, battery info, or a buzzer/LED/live
status.ContributionYou know;)
Package: aiotradier
aiotradierPython library to access Tradier´s API using Async IOTradier's documentation is athttps://documentation.tradier.com/brokerage-apiThis is a very lightweight library to wrap Tradier's API. It implements functions to access most of
the endpoints for Accounts, Market Data, and Trading. It does not include yet functions to access Authentication or Watchlists.
Instead of authenticating with the API, you can obtain a token by logging into your account.RequirementsPython >= 3.11InstallpipinstallaioatradierInstall from SourceRun the following command inside this folderpipinstall--upgrade.ExamplesExamples can be found in theexamplesfolder
Package: aiotrading
IntroductionCrypto exchange APIs are often callback-oriented. This makes coding a nightmare and will distract you from your most important goal of developing a winning strategy.aiotrading is here to solve this problem. Using it, interacting with exchanges will be as much fun as the followingexample:from aiotrading import CandleStream
from aiotrading.exchange import BinanceFutures

async with BinanceFutures() as exchange:
    async with CandleStream(exchange, 'btcusdt', '3m') as stream:
        for i in range(10):
            candle = await stream.read()
            log.info(candle)Sample output of this code example is:connecting to exchange: binance-futures
opening candle stream btcusdt@3m
candle btcusdt, 3m, t:2021-01-30 11:39:00, o:33795.69, h:33800.00, l:33789.99, c:33795.18, v:4.164
candle btcusdt, 3m, t:2021-01-30 11:39:00, o:33795.69, h:33800.00, l:33789.99, c:33799.76, v:4.481
candle btcusdt, 3m, t:2021-01-30 11:39:00, o:33795.69, h:33800.00, l:33789.99, c:33797.73, v:4.741
candle btcusdt, 3m, t:2021-01-30 11:39:00, o:33795.69, h:33800.00, l:33789.99, c:33797.47, v:5.132
candle btcusdt, 3m, t:2021-01-30 11:39:00, o:33795.69, h:33800.89, l:33789.99, c:33797.39, v:5.520
candle btcusdt, 3m, t:2021-01-30 11:39:00, o:33795.69, h:33800.89, l:33789.99, c:33797.38, v:5.605
candle btcusdt, 3m, t:2021-01-30 11:39:00, o:33795.69, h:33800.89, l:33789.99, c:33797.39, v:6.000
candle btcusdt, 3m, t:2021-01-30 11:39:00, o:33795.69, h:33807.99, l:33789.99, c:33806.80, v:16.562
candle btcusdt, 3m, t:2021-01-30 11:39:00, o:33795.69, h:33807.99, l:33789.99, c:33797.70, v:16.590
candle btcusdt, 3m, t:2021-01-30 11:39:00, o:33795.69, h:33807.99, l:33789.99, c:33794.60, v:17.342
closing candle stream btcusdt@3m
disconnecting from exchange: binance-futuresInstallationpip3 install aiotradingDesign PrinciplesThin portable API. Lots of exchanges exist in the wild and developers like to migrate from exchange to exchange with no hassle.Easy concurrency. No callbacks as they distract from the goal and introduce errors.Statusaiotrading is at its early stage of development. It currently supports a subset ofBinance exchange API services. More services will be supported in the future. It is designed in a way that other exchanges can be supported easily.
Package: aiotrans
Simple async Google Translate libraryInstalation:pip install aiotrans[aiohttp]orpip install aiotrans[httpx]FeatruresFast and reliable - it uses the same servers that translate.google.com usesSupport for httpx and aiohttpFully asyncio supportSimple result cachingExamplefromasyncioimportrunfromaiotransimportTranslaitorasyncdefmain():t=Translaitor()print(awaitt.translate("Hello",target='ru',source='en'))awaitt.transport.close()run(main())
Package: aiotranslate
aiotranslateFree google translate module that uses async/await syntax.ExamplefromaiotranslateimportTranslatorimportasyncioasyncdefmain():translator=Translator()# you can add aiohttp session if you want like -> Translator(session=aiohttp.ClientSession())# also you can save the translates like -> Translator(save_translates=True)translated=awaittranslator.translate("hello","tr","en")# first argument: the text will be translated# second argument: the language will converted# last argument: the language that textprint(translated)# -> Merhabaprint(translator.history())# shows all translates that saved.if__name__=="__main__":loop=asyncio.get_event_loop()loop.run_until_complete(main())