Saravanan666/pypi-org huggingface dataset:
Package: aiohelpersms
QuickstartInstall packagepip install aiohelpersmsInstall dependenciespip install -r aiohelpersms/requirements.txtSee examplesRead thedocumentationUsagefrom aiohelpersms import AioHelperSMS, BadApiKeyProvidedExceptionclient = AioHelperSMS('your_api_token')See examplebalance=awaitclient.get_balance()print(balance)countries=awaitclient.get_countries()print(countries)Exception handlingfromaiohelpersmsimportAioHelperSMS,BadApiKeyProvidedExceptionclient=AioHelperSMS(token)try:balance=awaitclient.get_balance()print(balance)exceptBadApiKeyProvidedExceptionase:print(e)> {'detail': 'Bad API key provided'}See the documentation for exceptions in theexceptions.mdfileSync versionfromaiohelpersmsimportHelperSMS,BadApiKeyProvidedExceptiontoken='your_api_token'defmain(token):client=HelperSMS(token)try:balance=client.get_balance()print(balance)countries=client.get_countries()print(countries)exceptBadApiKeyProvidedExceptionase:print(e)if__name__=='__main__':main()OtherLicenseProject AioHelperSMS is distributed under the MIT license
Package: aiohere
aiohereAsynchronous Python client for the HERE APIBased onherepyInstallationpipinstallaiohereUsagefromaiohereimportAioHere,WeatherProductTypeimportasyncioAPI_KEY=""asyncdefmain():"""Show example how to get weather forecast for your location."""asyncwithAioHere(api_key=API_KEY)asaiohere:response=awaitaiohere.weather_for_coordinates(latitude=49.9836187,longitude=8.2329145,products=[WeatherProductType.FORECAST_7DAYS_SIMPLE],)lowTemperature=response["dailyForecasts"][0]["forecasts"][0]["lowTemperature"]highTemperature=response["dailyForecasts"][0]["forecasts"][0]["highTemperature"]weekday=response["dailyForecasts"][0]["forecasts"][0]["weekday"]print(f"Temperature on{weekday}will be between{lowTemperature}°C and{highTemperature}°C")if__name__=="__main__":loop=asyncio.new_event_loop()loop.run_until_complete(main())
Package: aiohglib
aiohglibThe aiohglib is an asynchronous variant ofhglib, which is library with a fast, convenient interface to Mercurial. It uses Mercurial's command server for communication with hg.The code itself takes advantage of asyncio library and async/await syntax.Another difference against standard hglib is suport for timezones and changesets details like p1, p2 and extras.Basic usageimportasyncioimportaiohglibasyncdefmain():asyncwithaiohglib.open(path)asclient:log=awaitclient.log(revrange="tip")print(log)# Depending on your Python version you need to run one of those:# Python 3.7 or newerasyncio.run(main())# Python 3.6loop=asyncio.get_event_loop()loop.run_until_complete(main())loop.close()# Python 3.6 on Windowsloop=asyncio.ProactorEventLoop()loop.run_until_complete(main())loop.close()DependenciesPython 3.6pytzchardet(optional)Changelog1.5Changed string decoding and codec detection to be more safe.1.4Fixed await syntax in client.pyFixed redundant __bool__ in util.pyOptional detection of encoding for changeset's author and description via chardet moduleOptional safe_template is nownotused by defaultLicenceMITContactMichal Šiškamichal.515k4@gmail.com
Package: aiohomeconnect
aiohomeconnectDocumentation:https://aiohomeconnect.readthedocs.ioSource Code:https://github.com/MartinHjelmare/aiohomeconnectAn asyncio client for the Home Connect API.InstallationInstall this via pip (or your favourite package manager):pip install aiohomeconnectCreditsThis package was created withCopierand thebrowniebroke/pypackage-templateproject template.
Package: aiohoripy
This is a asynchronous wrapper for Hori-API namedaiohoripyThe way you use it it's so simple:importaiohoripy# orfromaiohoripyimportsfw,nsfwimportdiscordfromdiscord.extimportcommandsbot=commands.Bot(command_prefix="prefix",intents=discord.Intents.all())@bot.eventasyncdefon_ready():print("I'm ready")@bot.command()asyncdefwaifu(ctx):image=awaitsfw(tag="waifu")# orimage=awaitnsfw(tag="waifu")awaitctx.send(image)bot.run("TOKEN")The tags are the same as the tags that the api givessfw tags are:["all", "husbando", "waifu"]nsfw tags are:["ass", "ecchi", "ero", "hentai", "maid", "milf", "oppai", "oral", "paizuri", "selfies", "uniform"]The output thatimage`` gives is the same as the json results in the APIand you can get them with:image["code", "is_over18", "tag_id", "tag_name", "file", "url"]Made by lvlahraam#8435
Package: aiohttp
Key FeaturesSupports both client and server side of HTTP protocol.Supports both client and server Web-Sockets out-of-the-box and avoids
Callback Hell.Provides Web-server with middleware and pluggable routing.Getting startedClientTo get something from the web:importaiohttpimportasyncioasyncdefmain():asyncwithaiohttp.ClientSession()assession:asyncwithsession.get('http://python.org')asresponse:print("Status:",response.status)print("Content-type:",response.headers['content-type'])html=awaitresponse.text()print("Body:",html[:15],"...")asyncio.run(main())This prints:Status: 200
Content-type: text/html; charset=utf-8
Body: <!doctype html> ...Coming fromrequests? Readwhy we need so many lines.ServerAn example using a simple server:# examples/server_simple.pyfromaiohttpimportwebasyncdefhandle(request):name=request.match_info.get('name',"Anonymous")text="Hello, "+namereturnweb.Response(text=text)asyncdefwshandle(request):ws=web.WebSocketResponse()awaitws.prepare(request)asyncformsginws:ifmsg.type==web.WSMsgType.text:awaitws.send_str("Hello,{}".format(msg.data))elifmsg.type==web.WSMsgType.binary:awaitws.send_bytes(msg.data)elifmsg.type==web.WSMsgType.close:breakreturnwsapp=web.Application()app.add_routes([web.get('/',handle),web.get('/echo',wshandle),web.get('/{name}',handle)])if__name__=='__main__':web.run_app(app)Documentationhttps://aiohttp.readthedocs.io/Demoshttps://github.com/aio-libs/aiohttp-demosExternal linksThird party librariesBuilt with aiohttpPowered by aiohttpFeel free to make a Pull Request for adding your link to these pages!Communication channelsaio-libs Discussions:https://github.com/aio-libs/aiohttp/discussionsgitter chathttps://gitter.im/aio-libs/LobbyWe supportStack Overflow.
Please addaiohttptag to your question there.Requirementsasync-timeoutattrsmultidictyarlfrozenlistOptionally you may install theaiodnslibrary (highly recommended for sake of speed).Licenseaiohttpis offered under the Apache 2 license.KeepsafeThe aiohttp community would like to thank Keepsafe
(https://www.getkeepsafe.com) for its support in the early days of
the project.Source codeThe latest developer version is available in a GitHub repository:https://github.com/aio-libs/aiohttpBenchmarksIf you are interested in efficiency, the AsyncIO community maintains a
list of benchmarks on the official wiki:https://github.com/python/asyncio/wiki/Benchmarks
Package: aiohttp_ac_hipchat
A Python 3 [aiohttp](aiohttp.readthedocs.org)-based library for building [HipChat Connect add-ons](https://www.hipchat.com/docs/apiv2/addons).  This is an early, alpha-quality release,
but can be used to build real add-ons today.  Future versions may include backward-incompatible changes.RequirementsPython >= 3.3asynciohttps://pypi.python.org/pypi/asyncioLicenseaiohttp_ac_hipchatis offered under the Apache 2 license.Source codeThe latest developer version is available in a BitBucket repository:https://bitbucket.org/atlassianlabs/aiohttp_ac_hipchat
Package: aiohttp_ac_hipchat_postgre
aiohttp_ac_hipchat_postgre==================A Python 3 [aiohttp](http://aiohttp.readthedocs.org) -based library for using PostgreSQL stores with [aiohttp_ac_hipchat](http://bitbucket.org/atlassianlabs/aiohttp_ac_hipchat).  This is an early, alpha-quality release,but can be used to build real add-ons today.  Future versions may include backward-incompatible changes.Requirements------------- Python >= 3.3- asyncio https://pypi.python.org/pypi/asyncio- aiopg https://github.com/aio-libs/aiopgLicense-------``aiohttp_ac_hipchat_postgre`` is offered under the Apache 2 license.Source code-----------The latest developer version is available in a BitBucket repository:https://bitbucket.org/ramiroberrelleza/aiohttp_ac_hipchat_postgre
Package: aiohttp-admin
aiohttp_adminaiohttp_adminwill help you on building an admin interface
on top of an existing data model. Library designed to be database agnostic and
decoupled of any ORM or database layer. Admin module relies on async/await syntax (PEP492)
thusnotcompatible with Python older than 3.5.Designaiohttp_adminusing following design philosophy:backend and frontend of admin views are decoupled by REST API as a
result it is possible to change admin views without changing anypythoncode. On browser side user interacts with single page application (ng-admin).admin views are database agnostic, if it is possible to implement REST API
it should be straightforward to add admin views. Some filtering features may
be disabled if database do not support some kind of filtering.Supported backendsPostgreSQL with,aiopgandsqlalchemy.coreMySQL withaiomysqlandsqlalchemy.coreMongodb withmotorMailing Listhttps://groups.google.com/forum/#!forum/aio-libsRequirementsPython3.5+aiopgoraiomysqlormotorCHANGESxx
Package: aiohttp-admin2
Aiohttp adminDemo site|Demo source code.The aiohttp admin is a library for build admin interface for applications based
on the aiohttp. With this library you can ease to generate CRUD views for your
data (for data storages which support by aiohttp admin) and flexibly customize
representation and access to these.Free software: MIT licenseDocumentation:https://aiohttp-admin2.readthedocs.io.InstallationThe first step which you need to do it’s installing librarypipinstallaiohttp_admin2History0.1.0 (2020-04-28)First release on PyPI.
Package: aiohttp-aiocache
aiohttp-aiocacheCaching middleware foraiohttpserver
withaiocacheunder the hood.
Inspired byaiohttp-cache.Installationpipinstallaiohttp-aiocacheorpoetryaddaiohttp-aiocacheOptionalaiocachedependencies for redis, memcached and msgpack support
will not be installed. Install them manually if required.Usageimportasyncioimportaiohttp.webaswebfromaiocacheimportCachefromaiocache.serializersimportPickleSerializerfromaiohttp_aiocacheimportcached,register_cache@cached# mark handler with decoratorasyncdefhandler(_:web.Request)->web.Response:awaitasyncio.sleep(1)returnweb.Response(text="Hello world")app=web.Application()app.router.add_route("GET","/",handler)# create aiocache instancecache=Cache(Cache.MEMORY,serializer=PickleSerializer(),namespace="main",ttl=60,)# register cache backend in appplicationregister_cache(app,cache)web.run_app(app)LimitationsSupport caching for GET requests only.LicenseMIT
Package: aiohttp-api-client
aiohttp-api-clientRequires: python 3.6+, aiohttp.Example:importaiohttpfromaiohttp_api_client.json_apiimport\JsonApiClient,JsonApiRequest,JsonApiError,JsonApiDetailsasyncdefrun(http_client:aiohttp.ClientSession):api_client=JsonApiClient(http_client)response=awaitapi_client(JsonApiRequest('GET','https://example.com/api/'))assertresponse.json=={'ok':True}try:awaitapi_client(JsonApiRequest('GET','https://example.com/api/bad-request/'))exceptJsonApiErrorase:asserte.details==JsonApiDetails(http_status=400,http_reason='Bad Request',content_type='application/json',bytes=b'{"ok": false}',text='{"ok": false}',)else:assertFalse
Package: aiohttp-apiset
Package to build routes and validate request using swagger specification 2.0.FeaturesBuilding of the routing from specification swaggerUsing inclusions other specifications with concatenate urlOptional output of the resulting specification and view embedswagger-uiAdvanced router with TreeResourceExtract specify parameters from request and validate with jsonschemaSerialize data as response with middlewareUsecasePackage aiohttp_apiset allows supports several strategies:The foreign specification. When the specification
is made and maintained by another team.The specification in the code. When the fragments of specification
are placed in the docstrings.Mixed strategy. When routing are located in the specification files
and operations are described in the docstrings.Exampleasyncdefhandler(request,pet_id):"""
    ---
    tags: [Pet]
    description: Info about pet
    parameters:
      - name: pet_id
        in: path
        type: integer
        minimum: 0
    responses:
      200:
        description: OK
      400:
        description: Validation error
      404:
        description: Not found
    """pet=awaitdb.pets.find(pet_id)ifnotpet:return{'status':404,'msg':'Not Found'}return{'pet':pet,# dict serialized inside jsonify}defmain():router=SwaggerRouter(swagger_ui='/swagger/',version_ui=2,)router.add_get('/pets/{pet_id}',handler=handler)app=web.Application(router=router,middlewares=[jsonify],)web.run_app(app)Is now available in the swagger-ui to the addresshttp://localhost:8080/swagger/.
Available both branch swagger-ui. For use branch 3.x visithttp://localhost:8080/swagger/?version=3Examples:examplesDevelopmentCheck code:hatchrunlint:allFormat code:hatchrunlint:fmtRun tests:hatchrunpytestRun tests with coverage:hatchruncov
Package: aiohttp-asgi
aiohttp-asgiThis module provides a way to use any ASGI compatible frameworks and aiohttp together.ExamplefromaiohttpimportwebfromfastapiimportFastAPIfromstarlette.requestsimportRequestasASGIRequestfromaiohttp_asgiimportASGIResourceasgi_app=FastAPI()@asgi_app.get("/asgi")asyncdefroot(request:ASGIRequest):return{"message":"Hello World","root_path":request.scope.get("root_path")}aiohttp_app=web.Application()# Create ASGIResource which handle# any request startswith "/asgi"asgi_resource=ASGIResource(asgi_app,root_path="/asgi")# Register resourceaiohttp_app.router.register_resource(asgi_resource)# Mount startup and shutdown events from aiohttp to ASGI appasgi_resource.lifespan_mount(aiohttp_app)# Start the applicationweb.run_app(aiohttp_app)Installationpipinstallaiohttp-asgiASGI HTTP serverCommand line tool for starting aiohttp web server with ASGI app.ExampleCreate thetest_app.pyfromstarlette.applicationsimportStarlettefromstarlette.responsesimportJSONResponsefromstarlette.routingimportRouteasyncdefhomepage(request):returnJSONResponse({'hello':'world'})routes=[Route("/",endpoint=homepage)]application=Starlette(debug=True,routes=routes)and run thetest_app.pywithaiohttp-asgiaiohttp-asgi\--address"[::1]"\--port8080\test_app:applicationalternatively usingpython -mpython-maiohttp_asgi\--address"[::1]"\--port8080\test_app:application
Package: aiohttp_autoreload
Makes aiohttp server autoreload on source code change.It’s very first, heavily untested version that should be used only in development.Code is taken from tornado.autoreload module.call_periodic module is taken from akaIDIOT’s gisthttps://gist.github.com/akaIDIOT/48c2474bd606cd2422caInstalationpip install aiohttp_autoreloadProposed usageimportasyncioimportaiohttp_autoreloaddebug=True# Or falseloop=asyncio.get_event_loop()handler=app.make_handler(debug=debug,)ifdebug:aiohttp_autoreload.start()f=loop.create_server(handler,'0.0.0.0',8080)...
Package: aiohttpbabel
aiohttp_babel adds i18n and l10n support to aiohttp.Usage:importaiohttp_jinja2fromaiohttp.webimportApplicationfromaiohttp_babel.localeimport(load_gettext_translations,set_default_locale,set_locale_detector)fromaiohttp_babel.middlewaresimportbabel_middleware,_set_default_locale('en_GB')# set default locale, if necessary# load compiled localesload_gettext_translations('/path/to/locales','domain')# you can use your own locale detection method, if necessary.# aiohttp_babel checks cookie parameter `locale` or `Accept-Language`# header by default.defdetector(request):ifrequest.url.host=='es.example.com':return'es'elifrequest.url.host=='zh.example.com':return'zh'else:return'en'set_locale_detector(detector)jinja_loader=jinja2.FileSystemLoader('./templates')app=Application(middlewares=[babel_middleware])aiohttp_jinja2.setup(app,loader=jinja_loader)jinja_env=aiohttp_jinja2.get_env(app)jinja_env.globals['_']=_How to extract & compile locales:http://babel.pocoo.org/en/latest/messages.htmlhttp://babel.pocoo.org/en/latest/cmdline.htmlCode from:tornado-babel:https://github.com/openlabs/tornado-babeldjango-babel:https://github.com/python-babel/django-babel
Package: aiohttp-bam
HTTP basic authentication middleware for aiohttp.Parametersdef bam_factory(login, password, bypass_ws=False)创建一个basic auth的middlewarelogin:usernamepassword:passwordbypass_ws:绕过websocket请求，默认为Flase，不绕过Usage# server_simple.pyfromaiohttpimportwebfromaiohttp_bamimportbam_factoryasyncdefhandle(request):returnweb.Response(text="Hello")app=web.Application(middlewares=[bam_factory('your username','your password')])app.add_routes([web.get("/",handle)])web.run_app(app)
Package: aiohttp-basicauth
aiohttp-basicauthHTTP basic authentication middleware for aiohttp 3.0+.
Inspired byFlask-BasicAuth.RequirementsPython >= 3.5.3aiohttp >= 3.0Installationpip install aiohttp_basicauthSimple usagefromaiohttpimportwebfromaiohttp_basicauthimportBasicAuthMiddlewareauth=BasicAuthMiddleware(username='user',password='password')app=web.Application(middlewares=[auth])web.run_app(app,host='127.0.0.1',port=80)Protect specific view(s)fromaiohttpimportwebfromaiohttp_basicauthimportBasicAuthMiddlewareauth=BasicAuthMiddleware(username='user',password='password',force=False)asyncdefpublic_view(request):returnweb.Response(text='Public view')@auth.requiredasyncdefsecret_view(request):returnweb.Response(text='Secret view')app=web.Application(middlewares=[auth])app.router.add_route('GET','/public',public_view)app.router.add_route('GET','/secret',secret_view)web.run_app(app,host='127.0.0.1',port=80)Advanced usageYou can overridecheck_credentialsmethod to implement more complex user verification logic:fromaiohttpimportwebfromaiohttp_basicauthimportBasicAuthMiddlewareclassCustomBasicAuth(BasicAuthMiddleware):asyncdefcheck_credentials(self,username,password,request):# here, for example, you can search user in the database by passed `username` and `password`, etc.returnusername=='user'andpassword=='password'auth=CustomBasicAuth()app=web.Application(middlewares=[auth])web.run_app(app,host='127.0.0.1',port=80)
Package: aiohttp-basicauth-middleware
Aiohttp middleware for simple http basic
auth protection for some urls.Works with Python >= 3.6.Works with UTF-8 🖖Installationpipinstallaiohttp-basicauth-middlewareUsageapp=web.Application(loop=loop)app.router.add_route('GET','/hello',handler_a)app.router.add_route('GET','/admin/hello',handler_b)app.middlewares.append(basic_auth_middleware(('/admin',),{'user':'password'},))basic_auth_middlewarehas 3 params:list of protected urls. For example[‘/admin’]will match
with/admin/user, but will not match with/user/admin.auth dict – a dict with pairs: login-password.strategy (optional) for password comparision. For example you can
store hashed password inauth_dict. Seeaiohttp_basicauth_middleware.strategy.BaseStrategyandexample.strategyfor more information.Example with md5 password hashing:app=web.Application(loop=loop)app.router.add_route('GET','/hello',handler_a)app.router.add_route('GET','/admin/hello',handler_b)app.middlewares.append(basic_auth_middleware(('/admin',),{'user':'5f4dcc3b5aa765d61d8327deb882cf99'},lambdax:hashlib.md5(bytes(x,encoding='utf-8')).hexdigest(),))/admin/…will be accessed by the same login+password pair (‘user’, ‘password’).
Package: aiohttp-but-its-requests
aiohttp_but_its_requestsThe speed of aiohttp simplified to the level of requests.getaiohttp_but_its_requests.get(url)Returns aClientResponseobject.postaiohttp_but_its_requests.post(url, data)Returns aClientResponseobject.aiohttp_but_its_requests.delete(url)Returns aClientResponseobject.headaiohttp_but_its_requests.head(url)Returns aClientResponseobject.optionsaiohttp_but_its_requests.options(url)Returns aClientResponseobject.
Package: aiohttp-cache
Aiohttp-cacheWhat's aiohttp-cacheaiohttp-cacheis a plugin for aiohttp.web server that allow to use a
cache system to improve the performance of your site.How to use itWith in-memory backendimportasynciofromaiohttpimportwebfromaiohttp_cacheimport(# noqasetup_cache,cache,)PAYLOAD={"hello":"aiohttp_cache"}WAIT_TIME=2@cache()asyncdefsome_long_running_view(request:web.Request,)->web.Response:awaitasyncio.sleep(WAIT_TIME)payload=awaitrequest.json()returnweb.json_response(payload)app=web.Application()setup_cache(app)app.router.add_post("/",some_long_running_view)web.run_app(app)With redis backendNote: redis should be available at$CACHE_URLenv variable orredis://localhost:6379/0importasyncioimportyarlfromaiohttpimportwebfromenvparseimportenvfromaiohttp_cacheimport(# noqasetup_cache,cache,RedisConfig,)PAYLOAD={"hello":"aiohttp_cache"}WAIT_TIME=2@cache()asyncdefsome_long_running_view(request:web.Request,)->web.Response:awaitasyncio.sleep(WAIT_TIME)payload=awaitrequest.json()returnweb.json_response(payload)app=web.Application()url=yarl.URL(env.str("CACHE_URL",default="redis://localhost:6379/0"))setup_cache(app,cache_type="redis",backend_config=RedisConfig(db=int(url.path[1:]),host=url.host,port=url.port),)app.router.add_post("/",some_long_running_view)web.run_app(app)Example with a custom cache keyLet's say you would like to cache the requests just by the method and
json payload, then you can setup this as per the follwing example.Notedefault key_pattern is:DEFAULT_KEY_PATTERN=(AvailableKeys.method,AvailableKeys.host,AvailableKeys.path,AvailableKeys.postdata,AvailableKeys.ctype,)importasynciofromaiohttpimportwebfromaiohttp_cacheimport(setup_cache,cache,AvailableKeys,)# noqaPAYLOAD={"hello":"aiohttp_cache"}WAIT_TIME=2@cache()asyncdefsome_long_running_view(request:web.Request,)->web.Response:awaitasyncio.sleep(WAIT_TIME)payload=awaitrequest.json()returnweb.json_response(payload)custom_cache_key=(AvailableKeys.method,AvailableKeys.json)app=web.Application()setup_cache(app,key_pattern=custom_cache_key)app.router.add_post("/",some_long_running_view)web.run_app(app)Parametrize the cache decoratorimportasynciofromaiohttpimportwebfromaiohttp_cacheimport(# noqasetup_cache,cache,)PAYLOAD={"hello":"aiohttp_cache"}WAIT_TIME=2@cache(expires=1*24*3600,# in secondsunless=False,# anything what returns a bool. if True - skips cache)asyncdefsome_long_running_view(request:web.Request,)->web.Response:awaitasyncio.sleep(WAIT_TIME)payload=awaitrequest.json()returnweb.json_response(payload)app=web.Application()setup_cache(app)app.router.add_post("/",some_long_running_view)web.run_app(app)LicenseThis project is released under BSD license. Feel freeSource CodeThe latest developer version is available in a github repository:https://github.com/cr0hn/aiohttp-cacheDevelopment environmentdocker-compose run tests