Package: aiovast
VastA utility to easily scale functionalityTable of ContentsRequirementsInstallationInformationVastVast Event LoopVastSessionVast Bulk RequestsVast Bulk GetVast Bulk PostVast Bulk PutVast Bulk DeleteVast Bulk HeadExamplesRequirementsPython3.6+InstallationCreate a new virtual environment with python 3.6+Install the aiovast library$gitclonehttps://www.github.com/tannerburns/aiovast
$cdaiovast
$pip3install.InformationDetails about the aiovast utilityVastMain variablesloop: asyncio.new_event_loopmax_async_pool: int, default=32max_futures_pool: int, default=10000Vast Event LoopMain methodrun_in_eventlooparg1: functionObject, Callablethe function to run in the event looparg2: listOfArgs, listthe list of arguments to be mapped to the function in the event loopkwarg: report, default= Falsereturns results and statistics about the event loop runtimekwarg: disable_progress_bar, default= Falsedisables the progress bar from printing while the event loop runskwarg: progress_bar_color, default= greenprovide another color for the progress bar templateVastSessionVariablesloop: asyncio.new_event_loopmax_async_pool: int, default=32max_futures_pool: int, default=10000self.session: requests.sessionVast Bulk RequestsA function that can handle any method requests will acceptbulk_requestsarg1: listOfCalls, listformat: [ [[method: string, url: string], options: dictionary], [[method: string, url: string], options: dictionary], .. ]Function calls for single method typesVast Bulk Getbulk_get_requestsarg1: listOfCalls, listformat: [ [[url: string], options: dictionary], [[url: string], options: dictionary], .. ]Vast Bulk Postbulk_post_requestsarg1: listOfCalls, listformat: [ [[url: string], options: dictionary], [[url: string], options: dictionary], .. ]Vast Bulk Putbulk_put_requestsarg1: listOfCalls, listformat: [ [[url: string], options: dictionary], [[url: string], options: dictionary], .. ]Vast Bulk Deletebulk_delete_requestsarg1: listOfCalls, listformat: [ [[url: string], options: dictionary], [[url: string], options: dictionary], .. ]Vast Bulk Headbulk_head_requestsarg1: listOfCalls, listformat: [ [[url: string], options: dictionary], [[url: string], options: dictionary], .. ]Examples#Basic add exampledefadd(x,y):returnx+yif__name__=='__main__':rets=[add(x,y)forxinrange(0,5)foryinrange(5,10)]#Example bulk add using aiovast classfromaiovastimportVastdefadd(x,y):returnx+yif__name__=='__main__':aiovast=Vast()args=[[[x,y]]forxinrange(0,5)foryinrange(5,10)]rets=aiovast.run_in_eventloop(add,args)#Example using Vast context managerfromaiovastimportVastdefadd(x,y):returnx+yif__name__=='__main__':args=[[[x,y]]forxinrange(0,5)foryinrange(5,10)]withVast()asaiovast:rets=aiovast.run_in_eventloop(add,args)#Example bulk add using decoratorfromaiovast.decoratorsimportvast_loop@aiovast_loop(max_async_pool=16)defadd_in_bulk(x,y):returnx+yif__name__=='__main__':args=[[[x,y]]forxinrange(0,5)foryinrange(5,10)]rets=add_in_bulk(args)#Vast session for sending bulk requestsfromaiovast.requestsimportVastSessionsession=VastSession(max_async_pool=4)calls=[(['get','https://www.google.com'],{'headers':{'User-Agent':'custom'}}),(['post','https://www.github.com'],)]responses=session.bulk_requests(calls)