βοΈ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.
Two Ways to Use it
api fixture
- A fixture of requests for any testsimport requests
- Simply use the import statement to bring it into any file!
Syntax
def test_(api)
---or--- # just import it
# recommended
import requests
Usage
def test_api_fixture(api):
response = api.get(f"{BASE_URL}/api/cards")
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