
Product
Introducing the Alert Details Page: A Better Way to Explore Alerts
Socket's new Alert Details page is designed to surface more context, with a clearer layout, reachability dependency chains, and structured review.
batch-http-request
Advanced tools
The Batch HTTP Request is a Python package designed to handle multiple HTTP requests efficiently. It allows users to send a batch of requests and receive the corresponding responses in a structured format. The library also provides error handling capabilities, returning errors alongside successful responses if desired.
To install the library, you can use pip:
pip install batch-http-request
The Request class is used to define individual HTTP requests.
Attributes:
url (str): The URL for the request.method (str): The HTTP method (e.g., "GET", "POST").headers (List[Tuple[str, str]]): Optional list of headers.body (Optional[bytes]): Optional request body.Constructor:
Request(url: str, method: str, headers: Optional[List[Tuple[str, str]]] = [], body: Optional[bytes] = None)
The Response class represents the HTTP response.
Attributes:
status_code (int): The HTTP status code.headers (List[Tuple[str, str]]): List of response headers.body (bytes): Response body.Constructor:
Response(status_code: int, headers: List[Tuple[str, str]], body: bytes)
The batch_request function processes a list of Request objects and returns their corresponding Response objects or errors.
Parameters:
requests (List[Request]): A list of Request objects to be processed.return_panic (bool): If set to True, the function returns errors encountered during the request processing as RuntimeError objects. Defaults to False.Returns:
Response objects for successful requests and RuntimeError objects for failed requests if return_panic is True.Example:
from batch_http_request import Request, batch_request
requests = [
Request(url="https://api.example.com/data", method="GET"),
Request(url="https://api.example.com/submit", method="POST", body=b'{"key": "value"}')
]
responses = batch_request(requests, return_panic=True)
for response in responses:
if isinstance(response, Response):
print(f"Status: {response.status_code}, Body: {response.body}")
else:
print(f"Error: {response}")
Contributions are welcome! Please fork the repository and submit a pull request with your changes.
This project is licensed under the MIT License. See the LICENSE file for more details.
For any questions or issues, please open an issue on the GitHub repository or contact the maintainers directly.
FAQs
High performance batch http rqeuest
We found that batch-http-request demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Product
Socket's new Alert Details page is designed to surface more context, with a clearer layout, reachability dependency chains, and structured review.

Product
Campaign-level threat intelligence in Socket now shows when active supply chain attacks affect your repositories and packages.

Research
Malicious PyPI package sympy-dev targets SymPy users, a Python symbolic math library with 85 million monthly downloads.