Saravanan666/pypi-org huggingface dataset:
Package: aiotrello
aiotrelloAsync Trello Python libraryInstallationInstall withpip$pipinstallaiotrelloExamplesimportasyncio;loop=asyncio.get_event_loop()fromaiotrelloimportTrellotrello=Trello(key="123",token="abc123")# Initialize a new Trello clientasyncdefmain():# Create 10 boards and make a list for eachforiinrange(10):board=awaittrello.create_board(f"Board{i}")awaitboard.create_list("My List")# Delete all boards that start with "Board"forboardinawaittrello.get_boards():ifboard.name.startswith("Board"):awaitboard.delete()# Get a board and list, then make a new card, and finally, add a comment to itmy_board=awaittrello.get_board(lambdab:b.id=="123")my_list=awaitmy_board.get_list(lambdal:l.name=="My List")card=awaitmy_list.create_card("Hello World","Here is my awesome card")awaitcard.add_comment("aiotrello rocks!")# Move card (above example) to a different listmy_other_list=awaitmy_board.get_list(lambdal:l.name=="My Other List")awaitcard.move_to(my_other_list)# also supports moving to external boardsboard2=awaittrello.get_board(lambdab:b.name=="My Other Board")list2=awaitboard2.get_list(lambdal:l.name=="My Other List")awaitcard.move_to(list2,board2)# Edit a card (above), archive it, and then delete itawaitcard.edit(name="This card will be deleted soon..")awaitcard.archive()awaitcard.delete()try:loop.run_until_complete(main())finally:loop.run_until_complete(trello.session.close())# Remember to close the session!SupportJoin ourDiscord Server
Package: aiotrivia
aiotriviaAsync Wrapper for the OpenTDB APIInstallation$pipinstallgit+https://github.com/niztg/aiotriviaExample Usageimportasyncioimportaiotriviaclient=aiotrivia.TriviaClient()asyncdefmain():data=awaitclient.get_specific_question(category=20)foriindata:print('%s|%s'%(i.question,i.responses))awaitclient.close()# after you're done with everythingasyncio.get_event_loop().run_until_complete(main())Returns:Which figure from Greek mythology traveled to the underworld to return his wife Eurydice to the land of the living? | ['Daedalus', 'Hercules', 'Perseus', 'Orpheus']discord.py command usagefromaiotriviaimportTriviaClient,AiotriviaExceptionfromdiscord.extimportcommandsimportasyncioimportrandomclassTriviaCog(commands.Cog):def__init__(self,bot):self.bot=botself.trivia=TriviaClient()@commands.command()asyncdeftrivia(self,ctx,difficulty):try:question=awaitself.trivia.get_random_question(difficulty)exceptAiotriviaExceptionaserror:returnawaitctx.send(f"{error.__class__.__name__}:{error}")answers=question.responsesrandom.shuffle(answers)final_answers='\n'.join([f"{index}.{value}"forindex,valueinenumerate(answers,1)])message=awaitctx.send(f"**{question.question}**\n{final_answers}\n{question.type.capitalize()}Question about{question.category}")answer=answers.index(question.answer)+1awaitself.trivia.close()# cleaning uptry:whileTrue:msg=awaitself.client.wait_for('message',timeout=15,check=lambdam:m.id!=message.id)ifstr(answer)inmsg.content:returnawaitctx.send(f"{answer}was correct! ({question.answer})")exceptasyncio.TimeoutError:awaitctx.send(f"The correct answer was{question.answer}")defsetup(bot):bot.add_cog(TriviaCog(bot))For more info, read the documentationOr join the discord server
Package: aiotriviapy
triviapytriviapy is an async API wrapper foropen trivia databasethis is still a WIP but currently can return questions from specific or all categories and select the number you want to return.SetupMake sure you have python installedDownload the repositoryMake sure you have aiohttp installedPlace the triviapy folder in your project folder and have fun.Quick StartA:First import Game from triviapy and construct a Game object:fromtriviapyimportGamegame=Game()(optional) Set a game token, this will prevent repeat questions from occuring:awaitgame.gen_token()To see the categories avaliable you can dogame.categories(), this returns the below array of category names and ID's,
to use a category supply the number for the category you'd like questions from:[('General Knowledge',9),('Entertainment: Books',10),('Entertainment: Film',11),('Entertainment: Music',12),('Entertainment: Musicals & Theatres',13),('Entertainment: Television',14),('Entertainment: Video Games',15),('Entertainment: Board Games',16),('Science & Nature',17),('Science: Computers',18),('Science: Mathematics',19),('Mythology',20),('Sports',21),('Geography',22),('History',23),('Politics',24),('Art',25),('Celebrities',26),('Animals',27),('Vehicles',28),('Entertainment: Comics',29),('Science: Gadgets',30),('Entertainment: Japanese Anime & Manga',31),('Entertainment: Cartoon & Animations',32)]Create a round with question info, you can supplyqtyandcategoryas ints to specify the number of questions and what category you want. It defaults to one question of any category and returns aQuestionobject if only one if given or an array of them if multiple questions are requested.# This will give 10 questions from the music category.round_example=game.round(quantity=10,category=12)# This will give one question from a random categoryround_2=game.round()Question objects hold all the info needed about a question including: question, category, answers, correct answer, and difficulty:question=round_example[0]question_str=question.question# Returns the question as a stranswers=question.answers# Returns a preshuffled array with the 4 multiple choice answer posibilitiesanswer=question.answer# Returns the str of the answer, this is included in the answers array as well in the same str format.category=question.category# Returns the category of the question as a strdifficulty=question.difficulty# Returns the question difficulty (Easy, Medium or Hard)Error HandlingImporting errors:fromtriviapy.errorsimportTokenError,QuestionError,InvalidTokenError,CategoryErrorTokenErrorThis error will occur isgame.token()is unable to set a token, this error may be caused by opentdb outages or other errors.QuestionErrorThis error will occur if the number of questions exceeds that avaliable, when this occurs doawait game.reset()to reuse questions.InvalidTokenErrorThis error is raised due to an invalid or expired token, an api token will expire after 6 hours of no use. Do ``await game.gen_token``` to reset this.CategoryError:This error will occur if an invalid int is defined for a round category. To fix this double check what you are putting in.
Package: aiotruenas-client
Python Module for TrueNAS Websocket APIThis python module utilizes theTrueNAS Websocket APIto get state from a TrueNAS instance.Installationpip install aiotruenas-clientUsagefromaiotruenas_clientimportCachingMachineasTrueNASMachinemachine=awaitTrueNASMachine.create("hostname.of.machine",api_key="someapikey")datasets=awaitmachine.get_datasets()disks=awaitmachine.get_disks()jails=awaitmachine.get_jails()pools=awaitmachine.get_pools()vms=awaitmachine.get_vms()Alternatively, a username and password may also be supplied.MachineObject representing a TrueNAS instance.DatasetAvailable frommachine.datasets, contains information about the datasets on the pools on the machine.DiskAvailable frommachine.disks, contains information about the disks attached to the machine.JailAvailable frommachine.jails, contains information about the jails available on the machine.PoolAvailable frommachine.pools, contains information about the ZFS pools known to the machine.VirturalMachineAvailable frommachine.vms, contains information about the virtural machines available on the machine.Each instance has the following methods availabe:vm.startvm.stopvm.restartDevelopmentSetuppython3.8 -m venv .venv
source .venv/bin/activate

# Install Requirements
pip install -r requirements.txt

# Install Dev Requirements
pip install -r requirements-dev.txt

# One-Time Install of Commit Hooks
pre-commit installWorking With Methods & SubscriptionsWhen adding support for a new object, or updating existing code, it can be useful to see the raw response from the
TrueNAS machine from time to time. In order to help do that easily, you can drop a.auth.yamlfile in the root of
the repository, with the following content:host:"some.host.name"api_key:"someapikey"Usescripts/invoke_method.pyto call a method:python scripts/invoke_method.py disk.queryUsescripts/subscribe.pyto subscribe to a topic:python scripts/subscribe.py reporting.realtimeRun either with -h to see additional options.TestingTests are run withpytest.
Package: aiot-studio
AIoT StudioAIoT Studio is the official library to develop datasources, notebooks and dependency sets formnubo's AIoT Studio.InstallationRequirementsPython 2.7 or Python 3.4 and uprequestspandas≥ 0.20numpy$ pip install aiot-studioSimple datasource usagefromaiotstudio.searchimportto_pandasfromaiotstudio.loggingimportlogdefexecute(parameters):log.info("Hello aiot-studio")result=to_pandas({"from":"event","select":[{"count":"*"}]})returnresultConfigurationThe library needs to be configured with yourmnubo API credentials.
The credentials can be shared as follows (by decreasing order of priority):Environment variables:MNUBO_CLIENT_ID,MNUBO_CLIENT_SECRET,MNUBO_API_URLLocal config file:application.confat the root of the project or anywhere indicated by theMNUBO_CONFIG_FILEenvironment variableGlobal config file:~/.settings/mnubo/application.conf(orC:\Users\<username>\.settings\mnubo\application.confon Windows)For the last two options, the configuration file should look like this:[DEFAULT]
mnubo_client_id = {API_CLIENT_ID}
mnubo_client_secret = {API_CLIENT_SECRET}
mnubo_api_url = https://prod.api.mnubo.comAvailable packagesearchblobstoreloggingNotes:All "search" methods expect a MQL query as described in thesearch APIdocumentationBlob store methods are only available when the code runs inside mnubo's architecture, using it locally would throw aFeatureUnavailableError
Package: aiotube
aiotubeA library to access YouTube Public Data without YouTubeAPIDiscordGitHubREST API (BETA)Table of ContentsInstallationBuildingQuick StartUsageChannelVideoPlaylistInstallingPython 3.6 or higher is required# Linux/macOSpython3-mpipinstall-Uaiotube# Windowspython-mpipinstall-UaiotubeBuild from sourcepipinstallgit+https://github.com/jnsougata/aiotubeQuick Startimportaiotubechannel=aiotube.Channel('UCU9FEimjiOV3zN_5kujbCMQ')print(channel.metadata)# channel metadata in dict formatvideo=aiotube.Video('WVDT4lSozHk')print(video.metadata)# video metadata in dict formatplaylist=aiotube.Playlist('PL-xXQjd8X_Q-xXQjd8X_Q-xXQjd8X_Q-')print(playlist.metadata)# playlist metadata in dict formatsearch=aiotube.Search.video('YouTube Rewind 2018')print(search.metadata)# searched video metadata in dict formatsearch=aiotube.Search.channel('PewDiePie')print(search.metadata)# searched channel metadata in dict formatsearch=aiotube.Search.playlist('Unlock Your Third Eye')print(search.metadata)# searched playlist metadata in dict formatUsageChannelMethodReturn TypeDescriptionlive()boolReturns True if the channel is livestreaming_now()VideoReturns the video the channel is streaming nowcurrent_streams()List[str]Returns a list of ids of currently streaming videosold_streams()List[str]Returns a list of ids of previously streaming videosvideo_count()intReturns the number of videos uploaded by the channelupcoming()VideoReturns a video object of the upcoming videoupcomings()List[str]Returns a list of ids of upcoming videosplaylists()List[str]Returns a Playlist objectuploads(limit: int)List[str]Returns a list of video ids of the uploaded videoslast_uploaded()VideoVideo object of the most recently uploaded videolast_streamed()VideoVideo object of the most recently streamed videoPropertiesReturn TypesDescriptionmetadatadictReturns the metadata of the channel in dict formatVideoPropertiesReturn TypesDescriptionmetadataDict[str, Any]dictionary of video metadataPlaylistPropertyReturn TypeDescriptionmetadataDict[str, Any]dictionary of playlist metadataSearchMethodsReturn TypesDescriptionchannel(name: str)ChannelChannel object of the channel with the given keywordsvideo(name: str)VideoVideo object of the video with the given keywordsplaylist(name: str)PlaylistPlaylist object of the playlist with the given keywordschannels(name: str, limit: int)List[str]list of channel ids of the channels found with the given keywordsvideos(name: str, limit: int)List[str]list of video ids of the videos found with the given keywordsplaylists(name: str, limit: int)List[str]list of playlist ids of the playlists found with the given keywords
Package: aiotubes
AIOTUBEaiotubeAsynchronous YouTube APIExampleimportasynciofromaiotubeimportVideoasyncdefmain():client=Video("https://www.youtube.com/watch?v=MZ-cvXEvYI8")stream=(awaitclient.streams()).get_audio_only()awaitstream.download_filepath(filename="yeat.mp3")asyncio.run(main())
Package: aiotus
aiotus - Asynchronous tus client libraryaiotusimplements the client-side of thetusprotocol.FeaturesImplements thecore protocolas
well as thecreationandconcatenationextensions.Built-in retry support in case of communication errors.Extensive test bench, including tests against the referencetusdserver.Usageimportaiotuscreation_url="http://example.com/files"metadata={"Filename":"image.jpeg".encode(),"Content-Type":"image/jpeg".encode()}# Upload a file to a tus server.withopen("image.jpeg","rb")asf:location=awaitaiotus.upload(creation_url,f,metadata)# 'location' is the URL where the file was uploaded to.# Read back the metadata from the server.metadata=awaitaiotus.metadata(location)RequirementsPython≥ 3.8aiohttptenacityInstallationInstallaiotusfromPyPi:pip install aiotusDevelopment versions can be installed fromTestPyPi:pip install --index-url https://test.pypi.org/simple --extra-index-url https://pypi.org/simple aiotusDocumentationThe documentation can be found ataiotus.readthedocs.io.Licenseaiotusis licensed under the Apache 2.0 license.
Package: aiotusclient
tus.io uploader for Python asyncioaiotusclient is a fork of tus-py-client rewritten for Python asyncio and aiohttp.
It is used to communicate with storage proxies that handle large transfers for vfolder uploads and downloads.Package Structureaiotusclientclient: The client instance class which communicates between Backend.AI ManagerbaseuploaderanduploaderResponsible for chunking the file and asynchronously uploading to tus serverrequestHandles the uploading requestInstallationPrequisitesPython 3.7 or higher withpyenvandpyenv-virtualenv(optional but recommneded)Installation ProcessFirst, prepare the source clone of this agent:#gitclonehttps://github.com/lablup/aiotusclientFrom now on, let's assume all shell commands are executed inside the virtualenv. And we located in backend.ai root directory.Now install dependencies:#pipinstall-UaiotusclientWhen done, import into your code the aiotusclientfromaiotusclientimportclienttus_client=client.TusClient(session_create_url,session_upload_url,rqst.headers,params)ReferenceThis library was forked fromtus-py-clientand customized in order to facilitate asynchronous communication with our TUS server.
Package: aiotuyalan
Async Tuya LAN ControlIntegration withTuyaCloudsmart home devices using local LAN control and Python's asyncio library. This library was thrown together in a week to support some cheap bulbs that I bought expecting to useTuya-Converton, but got hit with thelatest firmwareversion from Tuya. At the time, I couldn't find any Python Tuya libraries supporting asyncio for local push use inHome Assistant.I only have tested Tuya lights with this library as that is the only device I own, I will include classes for the additional devices, but they will need to be tested to confirm usage.Example UsageThis library requires the device ID and the local key for the device you want to control. I found it easiest to snag the local key from anolder version of the Smart Life app's preferences.xml on a rooted Android phone. There are other methods you can read abouthere.fromaiotuyalanimportTuyaLightimportasyncioIP='192.168.1.26'LOCAL_KEY='fffff00000ffffff'DEVICE_ID='ffff000fff00f0f0f000'asyncdefmain():loop=asyncio.get_running_loop()device=TuyaLight(loop,IP,DEVICE_ID,LOCAL_KEY,version='3.3')asyncdefon_update():print("Received device update.")awaitdevice.set_color_temp(40)awaitdevice.set_brightness(255)awaitdevice.disconnect()asyncdefon_stop():print("Disconnected from device.")loop.stop()awaitdevice.set_on_update(on_update)awaitdevice.set_on_stop(on_stop)whileTrue:try:awaitdevice.connect()breakexceptExceptionaserr:print("Error occcured during connection: ",err)print("Trying again in  5 seconds...")awaitasyncio.sleep(5)print("Connected to device!")loop=asyncio.get_event_loop()try:asyncio.ensure_future(main())loop.run_forever()exceptKeyboardInterrupt:passfinally:loop.close()
Package: aio-typesense
aio_typesenseAsync Library for Typesense with type hintspipinstallaio_typesenseUsage# examples/example.pyimportasynciofromtypingimportTypedDict,Listfromaio_typesenseimportClient,CollectionclassMovie(TypedDict):id:strname:stryear:intMOVIES:List[Movie]=[{"id":"id1","name":"Wonder Woman","year":2017,"year_facet":"2017"},{"id":"id2","name":"Justice League","year":2017,"year_facet":"2017"},{"id":"id3","name":"Wonder Woman 1984","year":2020,"year_facet":"2020"},{"id":"id4","name":"Death on the Nile","year":2021,"year_facet":"2021"},]asyncdefmain():client=Client(node_urls=["http://localhost:8108"],api_key="Rhsdhas2asasdasj2",)r=awaitclient.collections.create({"name":"movies","num_documents":0,"fields":[{"name":"name","type":"string",},{"name":"year","type":"int32",},{"name":"year_facet","type":"string","facet":True,},],"default_sorting_field":"year",})collection:Collection[Movie]=client.collections["movies"]r=awaitcollection.documents.create_many(documents=MOVIES)print(r)search_r=awaitcollection.documents.search({"q":"wonder woman 2021","query_by":"year_facet,name","query_by_weights":"1,1",})print(search_r["hits"])# [#     {#         "document": {#             "id": "id3",#             "name": "Wonder Woman 1984",#             "year": 2020,#             "year_facet": "2020",#         },#         "highlights": [#             {#                 "field": "year_facet",#                 "matched_tokens": ["2020"],#                 "snippet": "<mark>2020</mark>",#             }#         ],#         "text_match": 1125899907169635,#     },#     {#         "document": {#             "id": "id1",#             "name": "Wonder Woman",#             "year": 2017,#             "year_facet": "2017",#         },#         "highlights": [#             {#                 "field": "year_facet",#                 "matched_tokens": ["2017"],#                 "snippet": "<mark>2017</mark>",#             }#         ],#         "text_match": 1125899907169379,#     },#     {#         "document": {#             "id": "id4",#             "name": "Death on the Nile",#             "year": 2021,#             "year_facet": "2021",#         },#         "highlights": [#             {#                 "field": "year_facet",#                 "matched_tokens": ["2021"],#                 "snippet": "<mark>2021</mark>",#             }#         ],#         "text_match": 562949953552128,#     },#     {#         "document": {#             "id": "id2",#             "name": "Justice League",#             "year": 2017,#             "year_facet": "2017",#         },#         "highlights": [#             {#                 "field": "year_facet",#                 "matched_tokens": ["2017"],#                 "snippet": "<mark>2017</mark>",#             }#         ],#         "text_match": 562949953551616,#     },# ]if__name__=="__main__":asyncio.run(main())ContributingPrerequisites:poetrynoxnox-poetryInstall them on your system:pipinstallpoetrynoxnox-poetryRun tests:nox
Package: aioudp
AioUDPA better API for asynchronous UDPAwebsockets-like API forUDPHere's an example echo server:importasyncioimportsignalimportaioudpasyncdefmain():asyncdefhandler(connection):asyncformessageinconnection:awaitconnection.send(message)# Optional. This is for properly exiting the server when Ctrl-C is pressed# or when the process is killed/terminatedloop=asyncio.get_running_loop()stop=loop.create_future()loop.add_signal_handler(signal.SIGTERM,stop.set_result,None)loop.add_signal_handler(signal.SIGINT,stop.set_result,None)# Serve the serverasyncwithaioudp.serve("localhost",9999,handler):awaitstop# Serve foreverif__name__=='__main__':asyncio.run(main())And a client to connect to the server:importasyncioimportaioudpasyncdefmain():asyncwithaioudp.connect("localhost",9999)asconnection:awaitconnection.send(b"Hello world!")assertawaitconnection.recv()==b"Hello world!"if__name__=='__main__':asyncio.run(main())InstallationYou can get this project viapip$pipinstallaioudpOr, if you're usingPoetry$poetryaddaioudp[!NOTE]
This library provides no other abstractions over the existing UDP interface inasyncioother than theasync/await-based API. This means there is no implicit protocol handled in this library such asQUIC. You must write your own, or find another library.See alsoAnyIO, a broader asynchronous networking and concurrency library for abstracting over anyasyncIO implementation. It has asimilar API(which I didn't know about before I wrote this library)WebSockets, a library for Python to interact with WebSockets. Its API heavily inspired the design of AioUDP.QUIC, a faster protocol similar to TCP, built on UDP.AioQUIC, a Python implementation of QUIC.LicenseCopyright © 2021, Bryan HuThis project is licensed under theGNU GPL v3+.In short, this means you can do anything with it (distribute, modify, sell) but if you were to publish your changes, you must make the source code and build instructions readily available.If you are a company using this project and want an exception, email me atthatxliner@gmail.comand we can discuss.
Package: aiounfurl
[![Build Status](https://travis-ci.org/TigorC/aiounfurl.svg?branch=master)](https://travis-ci.org/TigorC/aiounfurl)[![Coverage Status](https://coveralls.io/repos/github/TigorC/aiounfurl/badge.svg?branch=master)](https://coveralls.io/github/TigorC/aiounfurl?branch=master)## aiounfurlUsing this library you can extract meta information from web pages and create site preview.The library uses four sources of information:1. [oEmbed](http://oembed.com)2. [Open Graph](http://ogp.me)3. [Twitter Cards](https://dev.twitter.com/cards/overview)4. HTML meta tags## Requirements* python 3.5* aiohttp* beautifulsoup4* html5lib## Installation```bashpip install aiounfurl```## Example of usingTo extract all site data:```pythonimport asyncioimport aiohttpfrom pprint import pprintfrom aiounfurl.views import get_preview_data, fetch_allasync def get_links_data(links, loop):results = []async with aiohttp.ClientSession() as session:tasks = [fetch_all(session, l, loop) for l in links]results = await asyncio.gather(*tasks, loop=loop, return_exceptions=True)return [{'link':l, 'data': d} for l, d in zip(links, results)]links = ['https://habrahabr.ru/post/314606/','https://www.youtube.com/watch?v=9EftQMnuhvU','https://medium.freecodecamp.com/million-requests-per-second-with-python-95c137af319']loop = asyncio.get_event_loop()result = loop.run_until_complete(get_links_data(links, loop))loop.close()pprint(result)```## Server example.Full example you can find [here](https://github.com/TigorC/aiounfurl/blob/master/example/srv.py).Install required packages for running example:```bashpip install -r example/requirements.txt```Run `python srv.py runserver`, then open http://127.0.0.1:8080/## Running the example in DockerI added a docker image with the example in http://hub.docker.com/ to run the sample as a separate independent service.Running in the background:```bashdocker run --name aiounfurl -p 8080:8080 -d tigorc/aiounfurl```then you can open our example [http://127.0.0.1:8080/](http://127.0.0.1:8080/).Using the list of oEmbed providers (a json file with a list of providers /path_to_file/providers.json has to be preliminarily created):```bashdocker run --name aiounfurl -p 8080:8080 -e "OEMBED_PROVIDERS_FILE=/srv/app/providers.json" -v /path_to_file/providers.json:/srv/app/providers.json -d tigorc/aiounfurl```## TestsInstall the `tox` package and run command:```bashtox```