Skip to main content

API Testing Framework for Python

This Python package is designed to accelerate the development of API tests by providing a robust and flexible framework. It integrates seamlessly with Allure for detailed reporting, ensuring that every request and assertion is logged and visible in the test reports.


Table of Contents

  1. Overview
  2. Features
  3. Installation
  4. Usage
  5. Examples
  6. Contributing
  7. License

Overview

This framework simplifies the process of creating API tests by encapsulating HTTP requests and responses into reusable components. The Client class manages API sessions, while the ApiResponse class provides methods for validating HTTP responses. All interactions and assertions are automatically logged in Allure reports, making it easier to debug and analyze test results.


Features

  • Simplified Request Management: Easily send HTTP requests using the Client class.
  • Response Validation: Use the ApiResponse class to validate status codes, response times, JSON data, headers, and more.
  • Allure Integration: Automatically log request and response details in Allure reports.
  • Method Chaining: Chain multiple assertions for cleaner and more readable test code.
  • Session Support: Optionally use persistent sessions for better performance during test execution.

Installation

To install this package, you can use pip. First, ensure that you have Python 3.11+ installed on your system.

pip install rapidus

Alternatively, if you are using this as part of a project, include it in your requirements.txt file:

rapidus

Usage

Step 1: Import the Classes

from rapidus import Client

Step 2: Initialize the Client

base_url = "https://api.example.com"
client = Client(base_url=base_url, use_session=True)  # Use sessions for better performance

Step 3: Send Requests and Validate Responses

client.send_request(
    method="GET",
    endpoint="/users",
    headers={"Authorization": "Bearer <token>"}
).assert_status_code(200).assert_response_time(500).assert_json_contains("id", 123)

Step 4: Close the Session (If Used)

client.close()

Examples

Example 1: Basic GET Request

from rapidus import Client


Client(base_url="https://jsonplaceholder.typicode.com").send_request("GET", "/posts/1").assert_status_code(200).assert_json_contains("userId", 1)

Example 2: POST Request with JSON Payload

from rapidus import Client


client = Client(base_url="https://jsonplaceholder.typicode.com", use_session=True)

payload = {
    "title": "foo",
    "body": "bar",
    "userId": 1
}

response = client.send_request(
    method="POST",
    endpoint="/posts",
    json=payload
)

response.assert_status_code(201).assert_json_contains("id")
client.close()

Contributing

We welcome contributions from the community! If you'd like to contribute, please follow these steps:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature/new-feature).
  3. Make your changes and commit them (git commit -m "Add new feature").
  4. Push the branch (git push origin feature/new-feature).
  5. Submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for more details.


Contact

If you have any questions or need further assistance, feel free to open an issue or contact us directly.

Happy testing! 🚀

Metadata

Release files for rapidus 0.1.0

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

Source distribution (sdist)

Source distribution for rapidus 0.1.0
File Size Uploaded
rapidus-0.1.0.tar.gz 6.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rapidus 0.1.0
File Interpreter ABI Platform
rapidus-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.7 kB

Release files / rapidus-0.1.0.tar.gz

Download URL rapidus-0.1.0.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d7fe2f03e296fddf7ae3d154e2b84573881d561c2fd395c5250e2cc57ed0ac4d
BLAKE2b-256 checksum
How to use checksums
8d19d53d16e3a6665402b3929bd4d93941908424929a236d248d965afd681cf4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release files / rapidus-0.1.0-py3-none-any.whl

Download URL rapidus-0.1.0-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bc232bb356b75317ac066645d63592fe2682ac2ef905ef02b06b944aaa133982
BLAKE2b-256 checksum
How to use checksums
77d3a41bfbbe63224f8b3cc29b671303edcd156c72dcf2b4f50da194330edabd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release history Release notifications | RSS feed

This release

0.1.0 This release

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