Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

request-ray

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

request-ray

a batch based request package with retry stratgy that enables you to send X requests concurrently at rate of Y requests/execution

  • 0.1.2
  • PyPI
  • Socket score

Maintainers
1

Request Ray

PyPI version Build Status: License: MIT

a batch based request package with retry stratgy that enables you to send X requests concurrently at rate of Y requests/execution with max retries for each N

Setup

pip install request-ray

How to use

from request_ray import rray

requests = [{
    'method': 'POST',
    'url': 'https://google.com',
    'kwargs': {'data': json.dumps({'hello': 'world'}), 'headers': {'alpha': 'beta'}}
}, {
    'method': 'GET',
    'url': 'https://facebook.com',
    'kwargs': {}
}]

batch_size = 2 # max no of requests to send at a time
retry_policy = 3 # how many times to retry failed requests

responses rray.send_requests(requests, batch_size, retry_policy)
print(responses) # array of expected responses with structure in each element: {'index': 0, 'response': standard_response_object}

How it works

As shown below:

  • 6 requests are queued
  • first 3 are started
  • 1,3 get 200 ok and 2 get 500 so it's enqueued again
  • 2 is retried with next requests till it's statisfied or retry max reached

Diagram

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc