https://github.com/mrtrakos/multigather
Send multiple requests using 5-6 lines of code!
https://github.com/mrtrakos/multigather
async await multithread python python3 requests threading
Last synced: about 2 months ago
JSON representation
Send multiple requests using 5-6 lines of code!
- Host: GitHub
- URL: https://github.com/mrtrakos/multigather
- Owner: MrTrakos
- Created: 2024-05-09T07:10:16.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-10T09:08:35.000Z (almost 2 years ago)
- Last Synced: 2025-09-06T01:51:38.728Z (5 months ago)
- Topics: async, await, multithread, python, python3, requests, threading
- Language: Python
- Homepage:
- Size: 16.6 KB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MultiGather
**You can install package by:**
```bash
pip install MultiGather
```
**Simple example for POST:**
```python
import asyncio
from MultiGather.Client import Connection
from MultiGather.Types import Config, Request
# Replace with the actual URL for your POST endpoint.
url = "https://your-api-endpoint/posts"
# Replace with the data you want to send in the POST request
data = {"title": "New Post", "body": "This is a sample post content", "userId": 1}
async def main():
client = Connection(Config(timeout=10)) # Set timeout to 10 seconds (optional)
# Prepare a POST request object
post_request = Request(method="POST", url=url, json=data, amount=5) ## gonna send 5 requests
# Send the requests asynchronously and collect responses
responses = await client.sendRequest(post_request)
# Print the status code for each response
for response in responses:
print(f"POST response status: {response.status}")
asyncio.run(main())
```
**Simple example for GET:**
```python
import asyncio
from MultiGather.Client import Connection
from MultiGather.Types import Config, Request
# Replace with the actual URL for your GET endpoint.
url = "https://your-api-endpoint/posts"
async def main():
client = Connection(Config(timeout=10)) # Set timeout to 10 seconds (optional)
# Prepare a GET request object
get_request = Request(method="GET", url=url, amount=5) # send 5 requests.
# Send the requests asynchronously and collect responses
responses = await client.sendRequest(get_request)
# Print the status code for each response
for response in responses:
print(f"GET response status: {response.status}")
asyncio.run(main())
```