🌐
Real Python
realpython.com › api-integration-in-python
Python and REST APIs: Interacting With Web Services – Real Python
December 6, 2023 - This serializer, CountrySerializer, subclasses serializers.ModelSerializer to automatically generate JSON content based on the model fields of Country. Unless specified, a ModelSerializer subclass will include all fields from the Django model in the JSON. You can modify this behavior by setting fields to a list of data you wish to include. Just like Django, Django REST framework uses views to query data from the database to display to the user. Instead of writing REST API views from scratch, you can subclass Django REST framework’s ModelViewSet class, which has default views for common REST API operations.
🌐
DEV Community
dev.to › m4rri4nne › automating-your-api-tests-using-python-and-pytest-23cc
Automating your API tests using Python and Pytest - DEV Community
May 9, 2025 - This article is a tutorial of how you can start to write your automated tests for an API using python and pytest framework and how generate one report html. You can access the project used in this tutorial here.
Discussions

Rest assured equivalent in Python for Rest API automation testing - Stack Overflow
Find centralized, trusted content ... you use most. Learn more about Collectives ... Bring the best of human thought and AI automation together at your work. Explore Stack Internal ... in Java there is a rest-assured framework to make the API requests and validate the responses with various ways. Is there any alternative in Python... More on stackoverflow.com
🌐 stackoverflow.com
Best automation framework for API testing other than RestAssured? Something Python specific maybe.
Pytest+Requests More on reddit.com
🌐 r/QualityAssurance
23
16
October 21, 2024
Build a REST API from the ground up with Python
I read this whole post and appreciate the wok you put into it. I am a newbie and not familiar with these frameworks (or some of the underlying concepts) yet, but I can say that seeing your work from an intermediate perspective would be great in pushing things forward quickly. You’re a Java developer - so what are your thoughts on using Python to build out this toolset? Planning on switching ha More on reddit.com
🌐 r/learnpython
3
4
September 8, 2023
REST API testing with python projects
I presume you're wanting to test client side? I saw an excellent approach in the libcloud library where they mocked the request and the response. It monkey patches httplib2 (IIRC), which is great if you're using that. If you're using Requests or something else, at least the same design/arch would work. I am sure there are test harnesses already available for requests. More on reddit.com
🌐 r/Python
9
3
January 13, 2017
🌐
PyRest-Python
nareshnavinash.github.io › PyRest-Python
PyRest-Python | REST API automation framework with snap mode, includes comparing image files
PyRest is an automation framework to test REST API endpoints. This framework includes methods to download the image files from the rest API and then compare with the stored image files. This framework is built in Python and inspired from the simplicity of Karate framework by Intuit and snapshot ...
🌐
Applitools
testautomationu.applitools.com › python-api-testing
API Testing in Python - Test Automation University - Applitools
Welcome to the Test Automation University course on building an API test automation framework with Python.
🌐
GitHub
github.com › ikostan › REST_API_AUTOMATION
GitHub - ikostan/REST_API_AUTOMATION: Practice REST API test automation with Python 3
May 4, 2023 - This REST application written in Python was built to help testers learn to write API automation. The application has endpoints for you to practice automating GET, POST, PUT and DELETE methods.
Starred by 12 users
Forked by 2 users
Languages   Python 91.0% | HTML 9.0% | Python 91.0% | HTML 9.0%
🌐
Playwright
playwright.dev › api testing
API testing | Playwright Python
Use a session fixture for that. The part before yield is the before all and after is the after all. # ... @pytest.fixture(scope="session", autouse=True) def create_test_repository( api_request_context: APIRequestContext, ) -> Generator[None, None, None]: # Before all new_repo = api_request_context.post("/user/repos", data={"name": GITHUB_REPO}) assert new_repo.ok yield # After all deleted_repo = api_request_context.delete(f"/repos/{GITHUB_USER}/{GITHUB_REPO}") assert deleted_repo.ok
🌐
Udemy
udemy.com › development
Learn API Automation Testing with Python & BDD Framework
March 13, 2026 - Build Python automation Utilities to test Rest API’s with SQL DB Integration, Batch Jobs Automation,Web Scraping etc
Rating: 4.6 ​ - ​ 3.05K votes
🌐
GitHub
github.com › ranitdey › Rest-API-Automation
GitHub - ranitdey/Rest-API-Automation: Rest API automation using python and requests
Rest API automation using python and requests _ Used requests module in this framework to make http calles to the server. - Link to the awesome requests framework: http://docs.python-requests.org/en/master/ - Used Ptest as automation testing ...
Author   ranitdey
Find elsewhere
🌐
Udemy
udemy.com › development
Step by Step Rest API Testing using Python + Pytest +Allure
August 4, 2025 - Detailed knowledge of API Testing using Python(Requests) and its implementation while working as an API Tester · Ready to face API Automation testing interviews & also answer scenario based questions · Detailed understanding of RestAPI, Different Methods(GET, POST, PUT, DELETE, PATCH) & JSON Format
Rating: 4.6 ​ - ​ 1.23K votes
🌐
Medium
medium.com › @anandJeyakumar › automating-api-testing-with-python-requests-a-hands-on-guide-ba7c70d9d52a
Automating API Testing with Python Requests: A Hands-on Guide | by Anand Jeyakumar | Medium
February 20, 2025 - In this article, we’ll automate API testing using Python’s requests library with ReqRes. Ensure you have Python installed and install the requests library: ... We start by importing the necessary libraries and defining the base URL: We define the base URL and a function to generate random names: import requests import json import random import string BASE_URL = 'https://reqres.in/api/users' def generate_random_name(): return "Test" + ''.join(random.choices(string.digits, k=4))
🌐
Udemy
udemy.com › it & software
Building a Python REST API Test Automation Framework
November 2, 2021 - Build a Python Rest API automation framework from scratch using PyTest and Docker.
Rating: 4.5 ​ - ​ 137 votes
Top answer
1 of 3
5

In order to simulate the same functionality as in Java's rest-assured, you can use:

Option 1

requests module along with pytest

Option 2

Use an available module pyhttptest Here you just need to define your test-cases and request in a json file and run all your test cases using command line

And Last

My favorite and recommended one is pyresttest

pyresttest is tool for testing RESTful HTTP requests. It’s written in Python (hence the py prefix) but unless you intend to write extensions this does not require any Python programming. It will work just fine in a Ruby, Go, Node, or PHP project.

As a command line tool it works by specifying a root URL (host) address and then the path to a YAML configuration file. The configuration file enumerates a list of URLs to request and tests against the expected status code.

Cheers!!

2 of 3
0

If you are using Django or Django Rest Framework For developing your REST APIs then you can use the django.test.Client. It helps you simulate requests with data defined in your application. You can write a shell script which executes these files on a production server and then use the results to make sure code changes don't break any existing code.

from django.test import Client
c = Client()

# Call a POST request endpoint with data
response = c.post("/login/", {"username": "john", "password": "smith"})
status_code = response.status_code
if status_code==200:
    print("wow test case passed")

You can find the complete documentation from the django's official docs from this link official_docs_test_client

🌐
GitHub
github.com › topics › api-testing-python
api-testing-python · GitHub Topics · GitHub
A Rest-API test automation framework which is build on the top of Python language using PyTest Framework.
🌐
Reddit
reddit.com › r/qualityassurance › best automation framework for api testing other than restassured? something python specific maybe.
r/QualityAssurance on Reddit: Best automation framework for API testing other than RestAssured? Something Python specific maybe.
October 21, 2024 -

What automation framework have you used to automate api testing? How have you designed your tests(proj structure)? What factors you’ve focused on your api testing(status check, schema check, response value check)? Please share your experience.

🌐
Medium
medium.com › @amity_55334 › api-test-automation-with-python-f2dcb9964cb5
API Test Automation with Python. Setting up an API automation… | by Amit Yerva | Medium
July 19, 2021 - json.loads() method can be used to parse a valid JSON string and convert it into a Python Dictionary. We can include assertions for following to mark the test case results: Response body schema validation: Use validate function from jsonschema. If validation fails, it will throw an error. ... Here is the response for the get request to openweathermap api.
🌐
Medium
medium.com › @anandJeyakumar › exploring-a-scalable-rest-api-automation-framework-with-python-pytest-requests-and-faker-5a6d413ccf16
🔍 Exploring a Scalable REST API Automation Framework with Python, Pytest, Requests, and Faker — Real-World Petstore Demo | by Anand Jeyakumar | Medium
May 29, 2025 - Hey everyone 👋 In this article, we’ll go through how to build a scalable API automation framework using Python’s Pytest and Requests libraries, generate dynamic test data with Faker, and integrate Allure reports for detailed test insights.
🌐
Fleek IT Solutions
fleekitsolutions.com › home › blogs › api automation using python and open-source framework
API automation using Python and open-source framework
September 21, 2023 - In this blog, we will demonstrate how you can design an automation framework for API testing using Python.
🌐
GitHub
github.com › ashikkumar23 › api-framework-python
GitHub - ashikkumar23/api-framework-python: "A scalable, modular and user-friendly API automation framework built with Python for testing RESTful APIs." · GitHub
This is a Test Automation Framework with Python that is used to automate CRUD APIs · Automated CRUD (i.e., POST, GET, PUT, DELETE) APIs using python ... api-framework-python/ ├─ services/ │ ├─ restful_booker/ │ │ ├─ __init__.py ...
Starred by 8 users
Forked by 5 users
Languages   Python 97.3% | Shell 2.7%
🌐
GitHub
github.com › shahidv3 › python_rest_api_automation
GitHub - shahidv3/python_rest_api_automation: REST API automation framework using Python requests module
REST API automation framework using Python requests module - shahidv3/python_rest_api_automation
Starred by 6 users
Forked by 4 users
Languages   Python 100.0% | Python 100.0%
🌐
On Test Automation
ontestautomation.com › writing-tests-for-restful-apis-in-python-using-requests-part-1-basic-tests
Writing tests for RESTful APIs in Python using requests – part 1: basic tests | On Test Automation
December 12, 2019 - Then, all we need to do to get started is to create a new Python file and import the requests library using ... Our API under test For the examples in this blog post, I’ll be using the Zippopotam.us REST API. This API takes a country code and a zip code and returns location data associated with that country and zip code.