↗️api

A library for working with HTTP Clients and APIs.

What is requests?

Requests is an elegant and simple HTTP library for Python, built for human beings.

requests official documentation

Two Ways to Use it

  • api fixture - A fixture of requests for any tests

  • import requests - Simply use the import statement to bring it into any file!

Syntax

def test_(api)

---or--- # just import it

# recommended
import requests

Usage

api fixture
def test_api_fixture(api):
    response = api.get(f"{BASE_URL}/api/cards")
Recommended
import requests

response = requests.get(f"{BASE_URL}/api/cards")

CRUD

Requests provides everything you need out of the box, but these are probably the actions you want :)

GET

requests.get()

POST

requests.post()

DELETE

requests.delete()

PATCH

requests.patch()

PUT

requests.put()

Last updated