Skip to main content

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

Metadata

Release files for request-ray 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for request-ray 0.1.2
File Size Uploaded
request_ray-0.1.2.tar.gz 3.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for request-ray 0.1.2
File Interpreter ABI Platform
request_ray-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 8.6 kB

Release files / request_ray-0.1.2.tar.gz

Download URL request_ray-0.1.2.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
11aa327984eaa1616adb24c8ff702414a114003c58dbbd833a8582ec88db9490
BLAKE2b-256 checksum
How to use checksums
2f2d1e075b0c080d8330e99723adf076c2efbb285b59bd630b39bc258eb279f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.6.9

Release files / request_ray-0.1.2-py3-none-any.whl

Download URL request_ray-0.1.2-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f0ef3787ccc85cd399ac35eb4891340b16081bcd21383470472db3b7910c539c
BLAKE2b-256 checksum
How to use checksums
2bf48f1a8f3de20f0e4bd71afc6c50ad68cf2f6805a12929d944935823d9dc17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.6.9

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page