У нас вы можете посмотреть бесплатно Playwright Python 8 | 1st API Test или скачать в максимальном доступном качестве, видео которое было загружено на ютуб. Для загрузки выберите вариант из формы ниже:
Если кнопки скачивания не
загрузились
НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если возникают проблемы со скачиванием видео, пожалуйста напишите в поддержку по адресу внизу
страницы.
Спасибо за использование сервиса ClipSaver.ru
WHAT is API Testing API testing means sending HTTP requests (like GET, POST, PUT, DELETE) to application's backend and verifying the response (status code, body, headers) We test: Is the response correct? Is the status code right? (e.g., 200 OK, 404 Not Found) Is the returned response body valid? - DEMO - How to send API Requests Step 1 - Create a file under tests folder test_api_get.py Step 2 - Write first API test Step 3 - Run the test pytest tests/test_api_get.py can add -s to show the output - def test_api_get_request(playwright): request = playwright.request.new_context() response = request.get("https://jsonplaceholder.typicode.com/...") assert response.status == 200 json_data = response.json() print(json_data) assert json_data["id"] == 1 request.dispose() - Send request with headers response = request.get( "https://jsonplaceholder.typicode.com/...", headers={"Authorization": "Bearer your_token_here", "X-Api-Key": "abc123"}, ) - Send create headers block separately request = playwright.request.new_context( extra_http_headers={ "Authorization": "Bearer your_token_here", "Accept": "application/json", "X-Custom-Header": "value123" } response = request.get("https://api.example.com/protected-end...") - How to assert Responses Print response status print("Status Code:", response.status) Print the JSON response body print("Response JSON:", response.json()) Validate values inside JSON assert json_data["id"] == 1 assert json_data["userId"] == 1 print("ID and userId match expected values") - ▬▬▬▬▬▬▬ Share with all who may need this If my work has helped you, consider helping any animal near you, in any way you can Never Stop Learning Raghav Pal ▬▬▬▬ USEFUL LINKS ▬▬▬▬ ✅ ALL TUTORIALS - https://AutomationStepByStep.com/ Tools & Tips - https://bit.ly/2oBfwoR QnA Friday - https://bit.ly/2NgwGpw Sunday Special - https://bit.ly/2wB23BO 🙌 Connect with Raghav: Ask Raghav: https://bit.ly/2CoJGWf GitHub: https://github.com/Raghav-Pal Udemy: https://www.udemy.com/user/raghav-pal-3/ Shorts Eng - https://bit.ly/3H9bifV ➡️ Subscribe for more videos: / @raghavpal —